Jquery等待ajax执行完毕再继续执行下面代码的效果

来源:互联网 发布:码枫青少儿编程 编辑:程序博客网 时间:2024/06/02 05:54

Jquery等待ajax执行完毕再继续执行下面代码的效果,具体代码如下,其实就是将 jquery ajax 函数的 async 参数设置为 false 即可,该参数默认为 true:


$(document).ready(function(){loadphpernote();window.open('http://www.phpernote.com');});function loadphpernote(){var url='http://www.phpernote.com/ajax.php';var data='action=list';jQuery.ajax({type:'post',url:url,data:para,async:false,//false代表只有在等待ajax执行完毕后才执行window.open('http://www.phpernote.com')语句success:function (msg){$('#articleList').html(msg);}});}

原创粉丝点击