I need to send and receive some simple data with my mobile application. I do this using the jquery $.post function - but it seems to be very unstable.
Problem: Often, like 1 out of 10 times, the POST is sent, but the callback function is never run. I know from the serverside that the POST is received and that data is returned - yet often there's nothing happening on the clientside.
$.post(url, { 'username': username, 'password': password },
function(data) {
if (data.Message == "Ok") {
alert("Logged in OK.");
} else if (data.Message == "Error") {
alert("Error. Check username and password.");
} else {
alert("An unknown error has occured.");
}
});
The times when nothing happens on the client side (even though I see data has been sent to the server) - running the function again doesn't work. I have to reload the entire page and try again - and then everything works as normal.
The setup is jquery together with Kendo UI Mobile.
Is there another, more reliable way, to make this POST request using JavaScript?