c# - Cannot get response in ajax success -


My AJAX code is down In this I can not get feedback from server side C # code. But there is no problem with my server side code (I have checked it by debugging) From server side I am returning the string to this Ajax.

  $ .ajax ({type: "post", url: '@ system.Web.configuration.WebConfigurationManager.AppSettings ["BaseURL"]' + "Provider / GetState", Content Type: 'Application / Jason', data: {country ID: country_ID}, success: work (data) {warning (data);}});   

Server side code is below

  public string gatestate (string country ID) {int i = Convert.ToInt32 (country id); Var Description = objUserAccount.SP_Getstate (i) .toList (); If (details calculation & gt; 0) {return "success"; } Other {return "wrong"; }}    

Add datatype to your AJAX request like this , If the datatype does not match the data received from the server, then the AJAX error will call instead of success

  $. Ajax ({type: "POST", url: '@ system.Web.configuration .webConfigurationManager.AppSettings ["BaseURL"]' + NSSCTProvider / GetState ", Content Type: 'Application / Jason', Datatype:" Jason ", Data : {Country ID: country_ID}, success: function (data) {warning (data);}, error: function (data) {warning ("error occurred");}});   < / Div> 

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -