jquery - Ajax post fails if there is a js file request after -
jquery - Ajax post fails if there is a js file request after -
an ajax post request in process of page loading. found random fault, , readystate 0 when fault occurs.
after careful checking, found rule. if there js file request after post request, fails. if post request lastly request in process of page loading(or there image file request after), success.
i don't know why. there official explain this? thanks.
the js code when page loading:
$(document).ready(function(){ ... loading operaion ... $.ajax({ //get login info cache:false, type:'post', url:"/login_bar", data:"admin_type="+$("#container>div:eq(0)").attr("name")+"&item_id="+$("#life_container").attr("name"), async:'false', datatype:"json", success:function(json){ // operation ...... }, error:function(xhr, info, xx){ // when error, xhr.readystate == 0 $.alert({text:"network error",time:2000}); } }); ... loading operation ... });
the login_bar request error:
the login_bar request success:
jquery ajax
Comments
Post a Comment