I have the following calls:
getData(0);
getData(1);
getData(2);
These call a javascript function:
function getData(Code) {
$.post('/adminA/GetData',
{ Code: Code },
function (data) {
The problem is that my data gets returned out of order. Is there a way that I can have the data return in order?
Another alternative is to use ajaxSetup
function getData(Code) {
$.ajaxSetup({async: false});
$.post('/adminA/GetData',{
Code: Code }, function (data) {
// Do Something
});
$.ajaxSetup({async: true}); //So as to avoid any other ajax calls made sybchrounously
}
You can use $.ajax instead and set async to false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With