Skip to main content

Bug Tracker

Side navigation

#12279 closed bug (invalid)

Opened August 13, 2012 11:49AM UTC

Closed August 14, 2012 11:13AM UTC

$.ajax().fail() is called even if i get a status 200 response

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

hello there guys,

i'm setting up an ajax request and get a status 200 response. .done() is not even called and instead .fail() is called. my code looks like this:

	url : url,
	type : customRequest,
	dataType : 'application/x-www-form-urlencoded',
	data: requestArray,
	processData : true,
	beforeSend : function(req) {
		req.setRequestHeader('Authorization', 'someauthdataheader');
		req.setRequestHeader('Accept', 'someaccept header');
}).done(function(success, status, xhr) {
	console.log("i'm in done");
}).fail(function(xhr, error, status) {
	console.log("i'm in fail");

This is a cross domain request, in Google Chrome (Version 21.0.1180.75 m) with " --allow-cross-origin-auth-prompt --disable-web-security" as parameters to get cross domain working.

xhr.responseText gives me the exact json i was awaiting for a successfull request and xhr.status is 200.

Hope this helps.

Attachments (0)
Change History (4)

Changed August 13, 2012 02:06PM UTC by dmethvin comment:1

owner: → anonymous
status: newpending

A request can fail if the JSON is not valid, there is more to a failure than just a 200 response. What does your JSON response look like?

Changed August 13, 2012 02:20PM UTC by anonymous comment:2

status: pendingnew


responseText: "{"status":{"statusCode":"0000","statusMessage":"Success."}}"

so my JSON response is the above string without the quotation marks that are the outermost.

Changed August 14, 2012 10:43AM UTC by anonymous comment:3

this bug report can be closed mixed up dataType and contentType. worked now with the change to contentType.

thx to shoke on IRC to point that out to me.

Changed August 14, 2012 11:13AM UTC by mikesherov comment:4

resolution: → invalid
status: newclosed