1

I would like to know what are the properties of msg object from jquery.ajax(). I am throwing an exception inside asp.net static function, but I am unable to cast it in javascript.

Thanks for help

mko
  • 6,638
  • 12
  • 67
  • 118
  • http://www.novogeek.com/post/2009/12/13/Handling-AJAX-exceptions-of-ASPNET-using-jQuery.aspx - VERY NICE EXPLANATION – mko Jun 07 '11 at 13:59

2 Answers2

0

If you have exception in the Server-Side, then JavaScript couldn't catch the Exception cause JavaScript is in the Client-Side.

You can catch the exception by yourself in Server-Side and send a custom error message to Ajax "success function" to handle the error(Exception) you thrown

Maidot
  • 386
  • 4
  • 11
0

You can read the response from your .Net page e.g.

$(function(){
  $.ajax({
    type: 'POST',
    url: "test.aspx",
    data: "ref=test",
    success: function(r) {  },
    error: function(r) { alert(r.toString()); }
  });
});

You can then read the error message and do the necessary steps..

Marc Uberstein
  • 12,501
  • 3
  • 44
  • 72