Bug Tracker

Opened 5 years ago

Closed 5 years ago

#14493 closed bug (invalid)

$.ajax() Callbacks

Reported by: simon.hayllar@… Owned by: simon.hayllar@…
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:

Description

On our site we're using push notifications, when a user clicks on a link to download a file it cancels the active push notification. In Firefox this results in the error callback triggering in the $.ajax function, however none of the callbacks are triggered in Chrome.

If you comment out the $.ajax() part and un-comment the other JavaScript within the index.php you can see that in Chrome the ready state does change to 4 and has a status of 0. Firefox does have another readstate change of 2, so I'm unsure if this is a bug with Chrome itself.

index.php

<html>
	<head>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
		<script>
		/*
			var ajaxRequest;  
			
			try{
				// Opera 8.0+, Firefox, Safari
				ajaxRequest = new XMLHttpRequest();
			} catch (e){
				// Internet Explorer Browsers
				try{
					ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try{
						ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e){
						// Something went wrong
						alert("Your browser broke!");
					}
				}
			}
			ajaxRequest.onreadystatechange=function()
			{
				alert(ajaxRequest.readyState);
				alert(ajaxRequest.status);
			}
			ajaxRequest.open("GET","long_request.php",true);
			ajaxRequest.send();
		*/
		
		$.ajax({
			url : 'long_request.php',
			type : 'get',
			complete : function(){alert('complete')},
			success : function(){alert('success')},
			error : function(){alert('error')}
		});
		</script>
	</head>
	<body>
		<a href="get_file.php">Get File</a>
	</body>
</html>

long_request.php

<?php 
	sleep(30);
?>

get_file.php

<?php
	header('Content-type: application/txt');
	header('Content-Disposition: attachment; filename="file.txt"');
	echo date("l");
	echo "\r\n";
?>

Change History (3)

comment:1 Changed 5 years ago by dmethvin

Owner: set to simon.hayllar@…
Status: newpending

Does the problem still reproduce on the current 2.0.3, and on http://code.jquery.com/jquery-git2.js which is the future 2.1?

comment:2 Changed 5 years ago by anonymous

This issue still persist on 2.0.3 and 2.1. The Chrome version I'm on is 30.0.1599.101 m.

With above versions in Firefox, the request is canceled and I get the error alert() followed by the complete one. In Chrome the request is canceled and none of the alerts trigger.

comment:3 Changed 5 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.