var id = $("input#user_id").val();
if (id != "") {
$.post("function.php?act=check_id", { id: id }, function(data) {
if (data == "error") {
return false;
}
});
//some other codes going on here....
正如你所看到的,我试图将函数分解为来自 ajax post 的数据,但它继续在其他代码上运行。我的意思是 return false
不会破坏它。
我哪里错了?
谢谢
最佳答案
下面的代码需要进入 $.post()
函数内部,因为它会在返回时执行。 AJAX 调用之后的代码在返回之前执行。
AJAX = 异步 JavaScript 和 XML
关于jquery - 当有 ajax post 时不能破坏 jquery 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4270016/