javascript - Using Jquery inside of Razor -
i'm trying pass string javascript razor actionlink
string filtering =$("#hello").val();
@html.actionlink(name, controllername, new { sort = columm, order = orderby, filters = filtering })
but i'm not able access variable, try @:filtering
or "@filtering"
doesn't work anyway,
how can pass variable controller?
if want send or post data controller's action may try this...
<input type="submit" id="btnfilter" value="filter" name="btnfilter" /> $('#btnfilter').click(function () { var sort = sortvalue; var order = ordervalue; var filter= filtervalue; $.ajax({ type: 'post', url: '@url.action(actionname, controllername)', data:'{"sort":"' + sort+ '","order":"' + order+ '","filter":"' + filter+ '"}', contenttype: 'application/json; charset=utf-8', datatype: 'json', success: function (result) { }, error: function () { } }); });
then.... in controller action
public actionresult actionname(string sort ,string order , string filter) { // here.... }
Comments
Post a Comment