你的位置:首页 > 软件开发 > Java > Ajax关于readyState(状态值)和status(状态码)的研究

Ajax关于readyState(状态值)和status(状态码)的研究

发布时间:2016-06-26 23:00:08
var getfunction () { try{ //主流浏览器提供了 return new catch(e){ //低版本的IE浏览器没有提供 //所以必须使用IE浏览器的特定实现ActiveXObject return new ActiveX ...
var getfunction () {  try{    //主流浏览器提供了    return new catch(e){    //低版本的IE浏览器没有提供    //所以必须使用IE浏览器的特定实现ActiveXObject    return new ActiveXObject("Microsoft.);  }};var xhr = get// readyState 0=>初始化 1=>载入 2=>载入完成 3=>解析 4=>完成// console.log(xhr.readyState); 0xhr.open("TYPE", "URL", true);// console.log(xhr.readyState); 1xhr.send();// console.log(xhr.readyState); 1xhr.onreadystatechange = function () {  // console.log(xhr.status); //HTTP状态吗  // console.log(xhr.readyState); 2 3 4  if(xhr.readyState === 4 && xhr.status === 200){    alert(xhr.responseText);  }};

原标题:Ajax关于readyState(状态值)和status(状态码)的研究

关键词:ajax

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。