c# - Cannot get response in ajax success -



c# - Cannot get response in ajax success -

my ajax code below. in cannot response server side c# code. there no issues server side code ( have checked debugging ). server side returning string ajax.

$.ajax({ type: "post", url: '@system.web.configuration.webconfigurationmanager.appsettings["baseurl"]' +"provider/getstate", contenttype: 'application/json', data: {countryid: country_id }, success: function (data) { alert(data); } });

server side code below

public string getstate(string countryid) { int i= convert.toint32(countryid); var details = objuseraccount.sp_getstate(i).tolist(); if(details.count>0) { homecoming "success"; } else { homecoming "false"; } }

add datatype in ajax request this, if datatype not matched received info server ajax error phone call instead of success

$.ajax({ type: "post", url: '@system.web.configuration.webconfigurationmanager.appsettings["baseurl"]'+ nssctprovider/getstate", contenttype: 'application/json', datatype: "json", data: {countryid: country_id }, success: function (data) { alert(data); }, error: function(data){ alert("error occured"); } });

c# jquery ajax asp.net-mvc

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -