4

error not firing. but its showing on firebug
HTTP 500 error :
jQuery15105771912402844872_1324698623378({"Message":"Master Order \u0027MS1100014\u0027 customer name not provide.","StackTrace":"   at SimWeb.SimWebGuard.APICheck(String Token, String PublicKey, String ServiceName, String ServiceParam) in D:\Documents\Visual Studia 2010\Project\SimWeb\SimWeb\API\SimWebGuard.asmx.vb:line 249","ExceptionType":"System.Exception"});

jquery version 1.5.1

$.ajax({ crossDomain: true, cache: false, type: "GET", url: _url, data: _data, dataType: "jsonp", contentType: 'application/json; charset=utf-8', success: if_complete, jsonp: "callback", complete: function (requestState) { basicjs_ajaxCounter = basicjs_ajaxCounter - 1; $(".AjaxStatus").html("<img src='" + basicjs_ajaxLoadingImg + "' /> Working " + basicjs_ajaxCounter + " request(s)..."); if (basicjs_ajaxCounter == 0) $(".AjaxStatus").hide(); }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } });
printf
  • 110
  • 1
  • 8

2 Answers2

6

This is because the server returns 500 response. See this jsfiddle. If you use _url2 it works file, however, using _url will give you the behaviour which you observed. This is a known glitch in the jsonp implementation. See this question. As suggested there you can try using jquery-jsonp or just to avoid 500 responses from your server.

Community
  • 1
  • 1
Pencho Ilchev
  • 3,201
  • 18
  • 21
  • mm.. jquery-jsonp is working. but just return "error". this is jsonp limitation :(. i using old/slow style to handle this problem - send result OR maybe error msg. it's took me 3 days hardwork on public holiday to change all webservice. anyway. thanx for answer – printf Dec 27 '11 at 12:29
  • 1
    lol just avoid 500 responses from your server. what a practical solution. ty though :) – f0ster Jan 17 '13 at 22:02
0

I tried all possible ways and reached to the final conclusion that there is no way to handle Server Internal Error 500 status using jsonp. One possible workaround will be to use timeout function and upon time out do all the stuffs you would like to do on error. But, this is not again a good solution. You need to handle this from server side in not sending 500 Internal server error.

Manoj Kumar
  • 111
  • 3