2012-06-20 53 views

回答

1

如果你使用XHR使用處理程序。

var xhr = new XMLHttpRequest(); 
xhr.open('GET', "http://www.some.com", true); 
xhr.onreadystatechange = handler; 
xhr.send(); 


function handler(){ 

    if (this.readyState == this.DONE) 
    { 
      if (this.status == 200 && this.responseXML != null) 
      { 
       var response = xhr.responseXML; 

      } 
      else{ 
       console.log("status:" + xhr.status); 
       alert("xhr Errors Occured"); 
      } 
    } 
    else 
     console.log("currently the application is at " + this.readyState); 
} 

並在Firebug內部處理程序中放置斷點。