Asp.net Jquery Ajax Webmethod Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have webmethod 500 internal server error Meta Discuss the workings and policies of this site About Us jquery ajax post 500 internal server error asp net Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with 500 internal server error ajax asp net us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just ajax post 500 internal server error c# like you, helping each other. Join them; it only takes a minute: Sign up ASP.NET 500 Internal Server Error while calling webmethod from javascript up vote 0 down vote favorite 2 I'm trying to call the webmethod fucntionality using AJAX but unable to get the appropriate results. I have googled my problem and found many solution
500 Internal Server Error Web Service Call
but those didn't worked for me. Please guide me what I'm doing wrong. Help will be appreciated. Cheers Code Snippet function checkUserNameExists() { //initialization var pagePath = window.location.pathname + "/getUsername"; var value = document.getElementById('control_userName').value; var dataString = "{ 'value':'" + value + "' }"; $.ajax({ type: "GET", url: pagePath, data: dataString, contentType: "application/json; charset=utf-8", dataType: "json", error: function (XMLHttpRequest, textStatus, errorThrown) { }, success: function (result) { var flag = true; if (result != null) { flag = result.d; if (flag == "True") { alert('okay fine you are good'); } else { alert('try again'); } } } }); } Method in Behind Code file [WebMethod] [ScriptMethod(UseHttpGet = true)] public string getUsername(string value) { return "True"; } EXCEPTION ExceptionType: "System.InvalidOperationException" Message: "An attempt was made to call the method 'getUsername' using a POST request, which is not allowed." javascript c# asp.net ajax share|improve this question edited May 3 '15 at 10:09 asked May 3 '15 at 8:59 Muneeb Amjad 285211 add a comment| 3 Answers 3 active ol
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
Unknown Web Method
this site About Us Learn more about Stack Overflow the company Business Learn webmethod c# more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question failed to load resource: the server responded with a status of 500 (internal server error) x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up http://stackoverflow.com/questions/30011998/asp-net-500-internal-server-error-while-calling-webmethod-from-javascript Jquery $.ajax returns internal server error up vote 1 down vote favorite I am sure i am doing something bad here, but i cannot figure out what. Any advises please? And here is the debug info gathered UPDATE: By changing to data: "{var1:'test'}", and dataType: "json", everything works as expected jquery asp.net ajax share|improve this question edited Dec 16 '12 at 23:23 asked Dec 16 '12 at 22:59 OrElse 2,0842186183 5 I hope if you got a 500 response from the server it was not because anything was wrong with your client jQuery code! A 500 error is supposed to mean the fault is at the server. If that server predictably gives a 500 due to a request then it needs to be fixed. –Ray Toal Dec 16 '12 at 23:03 @RayToal nope! i do not get a 500 error. And The web method SaveValue is not called at all –OrElse Dec 16 '12 at 23:05 1 If you don't get a 500 error, then why is internal server error in the title? FYI: "internal server error" => 500 –Sparky Dec 16 '12 at 23:06 @Sparky I meant i do not get a server side 500 error. The webpage continues to operate norma
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/21375394/jquery-ajax-webmethod-error 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 https://sibasisjena.wordpress.com/2014/02/26/500-internal-server-error-while-calling-webmethod-from-javascript/ Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each internal server other. Join them; it only takes a minute: Sign up jQuery ajax webmethod error up vote 1 down vote favorite I have a webmethod returning an object and I am having difficulty accessing the object returned from the jQuery Ajax method. I would like to access the HighlightResults and display in a repeater. I keep getting the error: There internal server error was an error processing the request. Internal server error. My object is: public class SearchResults { internal SearchResults() { } public virtual IQueryable
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" %>