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?
Calling these three ajax requests synchronously will freeze your browser. You’d be better off using jQuery’s Deferred objects. Try this:
Addendum
You should also consider combining your calls into a single one, and change the server logic to handle it. This will ultimately be faster than three requests: