jquery - parameter Issue -
hello guys developing mvc application, want call action (with 2 parameter) when click on button , on event handler of button following :
var url = '<%: url.action("someaction", "someconroller") %>' $(location).attr('href', url, new { param1 : value1 , param2: value2 });
but not working .. how can pass parameters in case ??? ???
you want pass in 2 parameters url.action method:
var url = '<%: url.action("someaction", "someconroller", new { param1 = value1, param2 = value2 }) %>'
sorry, realised parameter values may not accessible in method. add placeholders , replace them afterwards:
var url = '<%: url.action("someaction", "someconroller", new { param1 = "val1", param2 = "val2" }) %>'; url = url.replace("val1", encodeuricomponent(value1)); url = url.replace("val2", encodeuricomponent(value2));
Comments
Post a Comment