开发者

Anyone know how I can get rid of this error message?

开发者 https://www.devze.com 2023-03-16 08:42 出处:网络
please take a quick look at this website I get the following error message since it takes time to read in \'parsers.json\'. Now to my question, is there a way to get rid of this annoying err开发者_开

please take a quick look at this website

I get the following error message since it takes time to read in 'parsers.json'. Now to my question, is there a way to get rid of this annoying err开发者_开发百科or message?

Line: 46 

Character: 3 

Code: 0 Error

Message: 'readyState' is null or not an object 

URL: http://tdsoft.se/failed.html


There is a JS function which is producing the error. It cannot find the variable 'readyState'

var checkState = function(xmlhttp, callback) {
//document.write(xmlhttp.readyState);
  if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  // --> failed.html:46Uncaught TypeError: Cannot read property 'readyState' of undefined
    callback();
  } else {
    // Check back again 1 sec later
    setTimeout(checkState, 1000);
  }
};

Why the document.write(xmlhttp.readyState); is been commented out? Might that be the bug.


I don't know why you would load jQuery and not use its ajax methods.

You can use either ajax or $.getJSON to do what you need to do.

My guess the problem with your code is the onreadystatechange is getting fired too quickly, possibly when the parsers.json is cached.


you should have a look at using the AJAX features of jQuery it's a much easier to use and more stable method of making AJAX requests.

0

精彩评论

暂无评论...
验证码 换一张
取 消