user1434739
user1434739

Reputation: 235

JQuery JSON Service won't consume

I am trying to consume my newly setup JSON service. I have created a basic fiddle which just alerts when run. As you will see it can't seem to get a response, but when you check the web service URL it is clearly sending a response. [http://196.34.92.60/api/api/v1/public.svc/getoperators]

Thanks for the help to the champ who can point out my mistake.

Fiddle address: http://jsfiddle.net/devin85/JmTe4/3/

Cheers Devin

Upvotes: 0

Views: 69

Answers (1)

Ash
Ash

Reputation: 1649

Your Json is invalid so your request is not able to parse. Also if it is from different domain, your datatype should be jsonp. Change your error to see the issue

 error: function(jqXHR, textStatus, errorThrown) {
        alert(textStatus);
    }

You are asking the url to return a JSON but your json is like this :: golden arrowjammiemyciti which is invalid. SO you need to make your result correct . It can look like this.

"result":"golden arrowjammiemyciti"

Also if your domain is differnt, you need to change it to JSONP. otherwise do a normal ajax request without any json type.

Upvotes: 1

Related Questions