Is there a way to send an HTTP GET or POST request to a server in order to assign the return value to a variable? I found this example in the NativeScript docs:
httpModule.getString("https://httpbin.org/get").then((r) => {
viewModel.set("getStringResult", r);
}, (e) => {
});
I am confused about what 'r' contains and what 'viewModel' represents. In jQuery, capturing an AJAX request is straightforward like this:
let returnValue;
$.post(url, function(data) {
returnValue = data;
});