jquery同步帖

时间:2013-03-01 05:30:12

标签: jquery ajax

在jquery网站上,他们告诉你,你可以这样做:

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

这将使此调用同步

但如果我使用jquery格式发布:

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

    }, "json");

如何使这种同步?

1 个答案:

答案 0 :(得分:9)

你可能不应该让它同步,but you can't。近似值是

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