How to catch NetworkError in JavaScript?

前端 未结 4 645
失恋的感觉
失恋的感觉 2021-02-07 01:30

In Chrome\'s JavaScript console, if I run this:

var that = new XMLHttpRequest();
that.open(\'GET\', \'http://this_is_a_bad_url.com\', false);
that.send();
         


        
4条回答
  •  渐次进展
    2021-02-07 01:51

    Look into the onreadystatechange event. You can get the status of the response.

提交回复
热议问题