On the client, I want to run this:
$.post(Session.get("website") + "wp-admin/admin-ajax.php", toSubmit, function(error, response){
console.log("Article ID", response);
});
When deploying and running in the browser, this works fine. When deploying and running as an Android app, toSubmit
is submitted (and does the appropriate stuff on the external server), but a response is never received/processed in the app. And an error is never returned.
Meanwhile, the following works fine in every circumstance:
$.get(url, function(data, status, request) {
if (data) {
data._id = "" + data.id;
News.upsert({_id: data._id}, data);
FlowRouter.go("/article/" + data._id);
}
}, 'json');
I’ve also tried post requests through the HTTP package, but those, too, fail when deployed to mobile.
How can this be resolved? That is, how can I do a POST request from the client to an external server and read the response?