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.
精彩评论