Pagemethods Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have 500 internal server error ajax get Meta Discuss the workings and policies of this site About Us
Failed To Load Resource: The Server Responded With A Status Of 500 (internal Server Error)
Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Using jQuery to directly call ASP.NET AJAX page methods — 500 (Internal Server Error) up vote 0 down vote favorite I'm learning about asp methods via ajax and... So I tried doing the ff. from this site: http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/ In JS file: $(document).ready(function () { // Add the page method call as an onclick handler for the div. $("#Result").click(function () { $.ajax({ type: "POST", url: "WebForm1.aspx/GetDate", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { // Replace the div's content with the page method's return. $("#Result").text(msg.d); } }); }); }); In aspx:
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up AJax Internal Server Error 500 up vote 0 http://stackoverflow.com/questions/21629348/using-jquery-to-directly-call-asp-net-ajax-page-methods-500-internal-server down vote favorite I have a page method issue I have this page method on a ASP.net webform [WebMethod(true)] public static int GetInt(int id){ return 10; } and I call it from JQuery like this $.ajax({ type: "POST", url: "webforms.aspx/GetInt", data: "{id:'1'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { }, error: function (err) { } }); This all works just fine, when I put a break http://stackoverflow.com/questions/19340638/ajax-internal-server-error-500 point on the server side it hits, but for some odd reason I after the PageMethod returns, I get the error call back of the ajax call never success! Any ideas. I cant use a script manager on this one! I open to any cross browser solution!. javascript jquery asp.net ajax share|improve this question asked Oct 13 '13 at 0:38 Ksliman 166316 Look at the actual HTTP response (in your dev tools) and read the error. –SLaks Oct 13 '13 at 0:40 1 Try removing dataType: "json", –Musa Oct 13 '13 at 0:43 The reponse offered no help. It had the same error message. Removing the dataType did not help either. –Ksliman Oct 13 '13 at 1:06 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted I used your code and am having no issues. Here is my exact code: WebForm1.aspx