The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

jquery.getJSON calls error BUT 200 OK is returned by service

Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 14, 2012

Hi all,

I'm developping plugins for Jira 5.1. Actually, I need to use json data returned from a rest service.

I have the following code:

jQuery.getJSON("http://myhost.xx/myservice")
	    	.success(function(data){
	    		alert("success!!!!!!");	    		
	    	})
	    	.error(function(jqXhr, textStatus, error) {
	    		alert("ERROR: " + textStatus + ", " + error);
	    	});

The funny thing is that, even I can see a correct response (200 accept, correct content type (text/json), correct body) with my http debugger (Fiddler), I only enter the "error" handler and I see "OK" for both textStatus and error parameters, ending in displaying the alert "ERROR: OK, OK" in my browser...

Any idea? Is there any known bug with the javascript shipped with Jira 5.1?

Thanks a lot !

6 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 15, 2012

Fixed, using a JSONP query type, and after transforming the backend, it works better

0 votes
saydur rahman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 19, 2016

although its an old post but it might help others.I was having the same problem and i found out the data i am getting from server was not in correct json format so it was giving me error.i fixed that and the thing got fixed

0 votes
Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 14, 2012

same behavior...

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 14, 2012

Have seen something very similar before. Can't remember the solution - but try using jQuery.ajax instead of getJSON, with "dataType:'json'"

0 votes
Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 14, 2012

Works perfectly fine with jQuery v1.4.4

0 votes
Séb P.
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 14, 2012

Exact same behavior using AJS.$() instead of jQuery()

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events