jQuery.ajax() vs. loadXML

jQuery.ajax() vs. loadXML


Hi,

I have the following code:

  1. myGrid.loadXML (myUrl, function () {
  2.       console.log (myGrid.getRowsNum ());
  3. });

and it is working well (I will see the number of rows of the grid on the console). But I replaced the following code with this:

  1. $.ajax({
  2.       type: "POST",
  3.       url: myUrl,
  4.       dataType: "text",
  5.       success: function(result) {
  6.             myGrid.parse(result);
  7.             console.log (myGrid.getRowsNum ());
  8.       }
  9. });

and the result is 0. Why? Function parse() should be synchronous, according to this  page.