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

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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

Works perfectly fine with jQuery v1.4.4

This widget could not be displayed.

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

This widget could not be displayed.

same behavior...

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

98 views 13 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you