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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -