jQuery: The Write Less, Do More JavaScript Library

Ticket #2174 (closed bug: fixed)

Opened 4 months ago

Last modified 4 months ago

"Invalid Label" error in FF2 doing JSON AJAX request

Reported by: dalangalma Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.3 Component: core
Version: 1.2.2 Keywords:
Cc: Needs: Review

Description

This seems to be a bug introduced in jQuery 1.2.2, since it works in 1.2.1:

I'm making an AJAX call like: $.ajax({

dataType: "json", success: function() { ... }, error: function() { ... }, url: "http://localhost:8080/myurl"

});

Firefox responds with "Invalid Label". If I change the url to "/myurl", it works. In jQuery 1.2.1, both work.

Attachments

Change History

Changed 4 months ago by osuchw

Here is use case that breaks in jquery-1.2.2 and Firefox Let's assume the form tag is generated dynamically and javascript is static and in separate file.

<html>
<head>
	<script type="text/javascript" src="jquery-1.2.2.min.js"></script>
	<script type="text/javascript">
	$(function() {
		var url = document.forms[0].action;
		//var url = '/notification/proxy.cfm/user/';
		$.getJSON(url,
			function(result){
				alert(result.rows.length);
				}
			);
	})
	</script>
</head>
<body>
	<form action="/notification/proxy.cfm/user/" type="GET">
	</form>
</body>
</html>

Changed 4 months ago by balupton

By using POST instead of GET the problem is avoided.

Works:

	// Do Ajax
	$.ajax({
		type: 'POST',
		url: 'http://localhost/path/actions.ajax.php',
		data: {test:'case'},
		dataType: 'json',
		success: function(result){
			alert(result);
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert(errorThrown);
		}
	});

Fails:

	// Do Ajax
	$.ajax({
		url: 'http://localhost/path/actions.ajax.php',
		data: {test:'case'},
		dataType: 'json',
		success: function(result){
			alert(result);
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert(errorThrown);
		}
	});

Changed 4 months ago by davidserduke

  • status changed from new to closed
  • resolution set to fixed

Ok, this should be fixed with [4476]. See the changeset for details. This change essentially returns the line to the way it was in 1.2.1 which was working.

Note: See TracTickets for help on using tickets.