Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery synchronous post

Tags:

jquery

ajax

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?

like image 281
Kam Avatar asked Nov 29 '25 16:11

Kam


1 Answers

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

$.ajaxSetup({async: false});
$.post();
like image 167
Explosion Pills Avatar answered Dec 02 '25 07:12

Explosion Pills



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!