Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 7 years ago

#4436 closed bug (fixed)

[ajax] j.readyState is null or not an object on IE6 with Timeout enabled

Reported by: ThomasCr Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

I get the follow error message when I make a ajax reqest as shown on IE 6. Timeout doesnt working.. I get triggerd asap the error callback with textStatus = timeout

j.readyState is null or not an object on IE6 with Timeout enabled

    $.ajax({
            url: base_url + 'index.php',
            data: params,
            type: 'POST',
            dataType: 'xml', 
            cache: false,
            timeout: 1000,
            success: this.action_success(this),
            error: this.action_error(this),
            complete: this.action_complete(this)
          })

I tested 1.3.1 and also the current 1.3.2

Change History (9)

comment:1 Changed 11 years ago by ThomasCr

oh.. I forgot to say, that when I remove the timeout option from the reqest, that it works, without a error.

comment:2 Changed 11 years ago by jmj

This error also happens in IE 7 for example:

$(document).ready(function() {
	$.ajax({
		url:"endless_loop.php",
		dataType:"json",
		timeout:2000,
		success: ExibeJSON,
		error: ExibeErro			
	});
});

function ExibeErro(XMLHttpRequest,textStatus,errorThrown) {
	alert(textStatus);
}

function ExibeJSON(jn) {
	alert(jn.lista);
}

comment:3 in reply to:  description Changed 11 years ago by snobo

I get it too, using IE7. It happens on the line "if (xhr.readyState == 0)" in the following fragment of 1.3.2 (line 3555):

// Wait for a response to come back
var onreadystatechange = function(isTimeout){
	// The request was aborted, clear the interval and decrement jQuery.active
	if (xhr.readyState == 0) {
		if (ival) {
			// clear poll interval
			clearInterval(ival);
			ival = null;
			// Handle the global AJAX counter
			if ( s.global && ! --jQuery.active )
				jQuery.event.trigger( "ajaxStop" );
		}

In FF3, no error.

comment:4 Changed 11 years ago by rsilva4

I get it too, using IE7. Can't say really where it is happening, a bunch of messy code in the page

comment:5 Changed 10 years ago by psu

I get it too with IE. Fixed by changing first if(J.readyState... check to if(J&&J.readyState... so it checks if object exists in first place.

comment:7 Changed 10 years ago by nomoon

I can confirm that this bug happens to me every time an ajax timeout event fires in IE 8. Very annoying.

comment:8 Changed 10 years ago by arsa

Also getting this issue - just enabled system-wide reporting of JS errors back to server, and this is the error i am getting. Should it not come into error handler?

comment:9 Changed 10 years ago by dmethvin

Component: unfiledajax
Resolution: fixed
Status: newclosed

This was fixed in 1.4. If you're having a problem with $.ajax in 1.4, please look for another ticket to open, ask for help on the forums, or create a new ticket with a clear test case.

comment:10 Changed 7 years ago by emamirazavi@…

i use jsonp, PHP Zend Framework, send 301 response code, and redirection header. firebug shows location header correctly, jQuery fire up ajaxError but readyState in not correct! my browser is FF v.20, my jquery version is 1.9.1. any ideas?

Note: See TracTickets for help on using tickets.