Kam
Kam

Reputation: 6008

jquery synchronous post

On jquery website they tell you that you can do this:

jQuery.ajax({
     type: "POST",
     url:    'http://example.com',
     success: function(result) {
              },
     async:   false
});     

And this will make this call synchronous

but what if I am using the jquery format to post:

     $.post( '../php/x.php', {},
     function( data ){  // a function to deal with the returned information
        }

    }, "json");

How can I make this synchronous?

Upvotes: 2

Views: 5974

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191749

You probably shouldn't be making it synchronous anyway, but you can't. An approximation would be

$.ajaxSetup({async: false});
$.post();

Upvotes: 9

Related Questions