jquery-Ajax请求用例码

        $.ajax({
                    type:"post",
                    url: 'domain’,
                    success:function(data){
                   console.log(data);
                    } ,
                    dataType: "json",
                    async:false
                });

 

警告:Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

问题是永远不建议用 async:false ---->设置为:

 

      $.ajax({
                    type:"post",
                    url: 'domain’,
                    success:function(data){
                   console.log(data);
                    } ,
                    dataType: "json",
                    async:true
                });

修改异步后,解决;

posted @ 2017-05-27 10:21  徐锅  阅读(374)  评论(0编辑  收藏  举报