jquery - MVC Controller is not access value from View using Json -
jquery - MVC Controller is not access value from View using Json -
i have created code send value json , fetch result based on value.
json code is:
$.getjson('/home/searchresult/' + cityname, function (data) { var items = ''; $.each(data, function (i, city) { items = city; }); $('#result').html(items); }); and @ controller code
public jsonresult searchresult(string cityname) { var result = cityname; homecoming json(result, jsonrequestbehavior.allowget); } but when checking value @ controller on cityname variable showing null value, while checked values passed on browser passing right value. request url:http://localhost:58301/home/searchresult/meerut
i not getting why value not showing on controller.
this work,i have tested in local , worked.
$.getjson('/home/searchresult/', { cityname: "kl" }, function (data) { var items = ''; $.each(data, function (i, city) { items = city; }); $('#result').html(items); }); }
jquery asp.net-mvc json asp.net-mvc-4
Comments
Post a Comment