Web service method is not accessible from jQuery ajax -


I am using jQuery Ajax to call a web service method but this is not causing the error ..

The code for the jQuery Ajax in the ASP page is here

  var indexNo = 13; // Pass the value $ (document). (Function () {$ ("# a1"). (Function () {$ .ajax ({type: "POST", url: "myWebService.asmx / GetNewDownline", data: "{'not index': User_id} ", content type:" app / jason; charset = utf-8 ", data type:" jason ", success: function (msg) {$ (" #devarsult ") .msg.d);}}); });});  

And this is the web service method

  using the system; Using System.Collections; Using System.Linq; Using System.Web; Using System.Web.Services; Using System.Web.Services.Protocols; Using System.Xml.Linq; Using System.Data; Using System.Web.Script.Serialization; TC Using MLM DAL; Using TC.MLM.BLL.AS; /// & lt; Summary & gt; /// myWebService summary descriptions for /// & lt; / Summary & gt; [WebServices (namespace = "http://tempuri.org/")] [webssebibing (conferfooto = WsiProfiles.BasicProfile1_1)] // To allow this web service to call scripts, using ASP.NET AJAX , Delete the following line. [System.Web.Script.Services.ScriptService] Public class myWebService: System.Web.Services.WebService {public myWebService ()} // reduce the following line / // initializeComponent (when using the designated components) ; } [WebMethod] Public string hello () {return "hello world"; } [WebMethod] Public string GetNewDownline (not string index) {index: index DTLL = new index description (); IndexDtls.IndexNo = "13"; Dataset ds = new dataset (); DS = TC.MLM.BLL.ASININandxGIndexDownline Base Index (IndexDTS); Index non-downline [] newDownOnline = new index notDownload [DTTables [0] .ROO.Count;] (Integer number = 0; count & lt; = ds.Tables [0] .Rows.Count - 1; calculation ++) {newdownline [count] = new indexDownline (); New downline [count]. Adjusted = DTTables [0] .REB [Calculation] ["Adjusted ADI"] Toasting (); NewDownline [Calculation] .name = ds.Tables [0] .reb [count] ["name"]. ToString (); New downline [countdown]. Strokepostian = DTTables [0] .Reb [count] ["Stratboza"]. Toasting (); New downline [count]. Index number = databables [0] .reb [count] ["not index"]. Toasting (); NewDownline [Calculation]. Promoter ID = DTTables [0] .REB [Calculation] ["PromotorId"]. Toasting (); NewDownline [Calculation] .formNo = ds.Tables [0] .REB [counts] ["Formono"]. Toasting (); } JavaScriptSerializer serializer = new JavaScriptSerializer (); JavaScriptSerializer JS = New JavaScript Serializer (); String result asDownown = js.Serialize (newdownline); Return result as downline; } Public class index nonundane {adjust public strings; The name of the public string; Not public string index; Public string structure postcard; Public string promoter ID; Not public string form; }}  

Please help me

Your input JSON data There is a problem in manual rather than manual serialization, you should try to use a built-in JSON class. East.

  $ Ajax ({... data: JSON.stringify ({indexNo: user_id}), ...});  

This should fix your problem.


Comments