Thanks for the response. After setting a breakpoint in the code behind, the function is called and returns the expected string. Looked at the article, and believe I am already handling the error as demonstrated in the it, unless I missed something. I
still cannot figure out why the ajax call results in error.
Put a debugger in the error function in the ajax call and check what error you are getting. If breack point does not work put a statement like
debugger; in the erro method and check the detail of the parameters. You can see internal error.
Thanks & Regards
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
Marked as answer by algorhythm on Jan 09, 2013 04:07 PM
algorhythm
Member
50 Points
53 Posts
jQuery AJAX Call to Page Method Results in Error With No Details
Jan 08, 2013 02:10 AM|LINK
$.ajax({ type: "POST", url: "PEReport.aspx/GenerateReport", data: "{}", contentType: "application/json", dataType: "json", success: function (data) { loadObject.innerHTML = data.d; $("#ExportData").show(); }, error: function (xhr, status, err) { var err = eval("(" + xhr.responseText + ")"); alert(err.Message); } });This always results in error, and xhr.responseText is empty. I have a master page with the ScriptManager, and EnablePageMethods is set to true.
urenjoy
Star
12253 Points
1840 Posts
Re: jQuery AJAX Call to Page Method Results in Error With No Details
Jan 08, 2013 09:55 AM|LINK
Put a break point and make sure GenerateReport method is called server side and returns string.
Look also at this encosia article for proper error handling.
algorhythm
Member
50 Points
53 Posts
Re: jQuery AJAX Call to Page Method Results in Error With No Details
Jan 08, 2013 07:19 PM|LINK
Thanks for the response. After setting a breakpoint in the code behind, the function is called and returns the expected string. Looked at the article, and believe I am already handling the error as demonstrated in the it, unless I missed something. I still cannot figure out why the ajax call results in error.
asteranup
All-Star
30184 Points
4906 Posts
Re: jQuery AJAX Call to Page Method Results in Error With No Details
Jan 09, 2013 02:03 AM|LINK
Hi,
Put a debugger in the error function in the ajax call and check what error you are getting. If breack point does not work put a statement like debugger; in the erro method and check the detail of the parameters. You can see internal error.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
priyankmtr
Contributor
2626 Points
526 Posts
Re: jQuery AJAX Call to Page Method Results in Error With No Details
Jan 09, 2013 05:59 AM|LINK
check this :
http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/
(Mark as Answer If you find helpful)
algorhythm
Member
50 Points
53 Posts
Re: jQuery AJAX Call to Page Method Results in Error With No Details
Jan 09, 2013 04:08 PM|LINK
Thanks, once I put the debugger statement, I was able to see the problem. The returned string was too long.