Page Method Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions jquery ajax webmethod 500 internal server error you might have Meta Discuss the workings and policies of jquery ajax post 500 internal server error asp net this site About Us Learn more about Stack Overflow the company Business Learn more about hiring 500 internal server error ajax asp net 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 500 internal server error web service call a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up asp.net pagemethod call, using jquery, returns error status 500 up vote 0 down vote favorite I haven't been able to find any good solutions to this issue, so I need som help.
Ajax Post 500 Internal Server Error C#
I have a PageMethod that I need to call with jquery. The client code looks like this: and the codebehind PageMethod looks like this: [WebMethod] public static double GetTotPrice(int antal) { double totpris = 0; Product _product = Product.GetProductByDate(DateTime.Today); if (_product != null) { totpris = _product.ProductNuPris * antal; } return totpris; } The call returns an error 500. I can't see the reason for this. jquery asp.net pagemethods share|improve this question asked Mar 16 '11 at 10:54 Soeren 44821636 have you been able to run your webmethod in the debugger to make sure
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings
500 (internal Server Error) Ajax Get
and policies of this site About Us Learn more about Stack Overflow unknown web method the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation unknown web method . parameter name: methodname 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 http://stackoverflow.com/questions/5324258/asp-net-pagemethod-call-using-jquery-returns-error-status-500 only takes a minute: Sign up Ajax call results in 500 Internal Server Error up vote 0 down vote favorite I have read similar posts and Modified according to them ..still not able to fix this error on My Page .. On Debug ..In FireBug there is no other error shown in Console ..Just this Error 500 Internal Server Error http://stackoverflow.com/questions/24241010/ajax-call-results-in-500-internal-server-error ....parameters Name in method is also same this is my ajax method : function getErrorStatusList() { var serve = new Object(); serve.issueID = $("#proselct option:selected").val(); $.ajax({ type: "POST", url: "UFZillaErrorStatus.aspx/GetErrorStatusList", data: JSON.stringify(serve), contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { }, error: function () { alert("Server Error!!");} }); this is WebMethod public partial class UFZillaErrorStatus : System.Web.UI.Page { [WebMethod] public static UFZillaErrorStatusList GetErrorStatusList(int issueID) { return Dashboard.Model.UFZillaErrorStatus.UFZillaErrorStatusService.Get(issueID); } } what Else could be done to track this issue ..Any Suggestion would be Helpful jquery ajax webmethod share|improve this question edited Jun 16 '14 at 9:59 asked Jun 16 '14 at 9:56 Neeraj Verma 3372716 is this whole code in WebMethod? seems like class is not closed. –Bojan Kovacevic Jun 16 '14 at 10:01 try adding headers "Accept" and "Content-Type" with the value of "application/json", to ajax. –Chintan Soni Jun 16 '14 at 10:01 do you mean i need to change "contentType: "application/json; charset=utf-8"," ?? can you please tell me new values ?? –Neeraj Verma Jun 16 '14 at 10:03 add a com
here for a quick overview of the site Help Center Detailed answers http://stackoverflow.com/questions/21629348/using-jquery-to-directly-call-asp-net-ajax-page-methods-500-internal-server 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 https://sibasisjena.wordpress.com/2014/02/26/500-internal-server-error-while-calling-webmethod-from-javascript/ 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 internal server 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 internal server error 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:
Handle single quote in Javascript Please down load the project This is the error due to single quote in your input parameter I am going to explain this issue with an example: there are two input fields in my page 1. Name 2. State Case1 : put any value except single quote in both the fields and submit. it will work fine. Case2 : put single quote in name field and in state field put any value. Open firebug console and check result:500 Internal Server Error Problem : The single quote is creating problem. Solution:Replace all the single quote in the value with a ♣ and in webmethod again replace all the ♣ with single quote. login.aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="CallAjaxWebmethod.login" %>