I am trying to 'GET' data from my WebAPI using JQuery $.ajax(). Here is my code:
$.ajax({
type: "GET",
url: "http://localhost:62412/api/RandomData?startTime=2013-02-23%2005%3A00%3A00&callback=?",
dataType: "jsonp",
success: function (data) {
alert("success");
},
error: function (errorData) {
alert("fail");
}// When Service call fails
});
I can see that the WebAPI works properly and returns the data successfully. But on the client side I always get the 'fail' alert. I can see the data in firebug.
Can anybody please let me know why the 'error' function is getting invoked when the response status is '200'?