ASP.NET scriptmanager getting error 500 when posting to server with AJAX

merzoug07

New Member
I asked a question yesterday where it was closed with duplication reason,However I still did not get an answer how to resolve my issue and i need some assistance.I am using ASP.NET with script manager\[code\]<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" EnablePartialRendering="true" runat="server" />\[/code\]I am getting error 500 when trying to post data to server.Bad code with Error 500:CS:\[code\][WebMethod]public static void SetCurrentBaseVersion(string id){ // need to get here}\[/code\]JS:\[code\]function postNewBaseLine() { var id = "300"; $.ajax({ type: "POST", url: "ManagerBaseKit.aspx/SetCurrentBaseVersion", contentType: "application/json; charset=utf-8", dataType: "json", data: {'id' :id}, success: function (data) { alert('success!'); }, statusCode: { 500: function () { alert('got error 500'); } } });}\[/code\]What I found so far that if I remove the string id in the webmethod it is working fine and I am being able to reach the SetCurrentBaseVersion (not getting error 500)Working Code:CS\[code\][WebMethod]public static void SetCurrentBaseVersion() //removed the string id{ // need to get here}\[/code\]JS\[code\]function postNewBaseLine(id) { var id = "300"; $.ajax({ type: "POST", url: "ManagerBaseKit.aspx/SetCurrentBaseVersion", contentType: "application/json; charset=utf-8", dataType: "json", //data: {'id' :id}, removed the data success: function (data) { alert('success!'); }, statusCode: { 500: function () { alert('got error 500'); } } });}\[/code\]
 
Back
Top