Can one use the “Backendless._ajax()” method in the JS SDK directly in JS and Node.JS code? If so, is there any documentation about how to do this, in particular about the “asyncHandler” attribute of the config argument and what that should be?
This function is used internally by SDK to handle all the request-response routine for you, enabling you with much more convenient SDK methods. It is not supposed to be used directly, so we don’t put it into documentation.
Sure you have access to this function just like to any other function in backendless.js and you can use it in your code, but why would you need that? I can’t see how you would possibly take any real advantage of it.
The reason I ask is just that this may be a convenient way to add the ajax capability required to access Node.js scripts in Backendless from a browser.
Sounds like you’re asking about invoking a script from the browser-side, although the original question was “scoped” to both JS and Node.JS.
From the browser side it could also be the good ol’ jQuery to invoke your Node.JS scripts.
I also fully agree that in many/most cases jQuery would be preferred. There are some cases though, such as if one wants to incorporate a payments gateway, where one would prefer to not include a package like jQuery, or even AngularJS, that essentially allows arbitrary hidden manipulation of the DOM if possible.
But you don’t need all this overhead to call hosted scripts. You can use the same native XMLHttpRequest and I believe it’ll keep your code clean and lacking unexpected side-effects.