asp.net mvc - Difference between anchor link & window.location? -
i have link below:
<a href='@url.action("myaction","mycontroller", new searchcriteriaaffaire { page=3, pagesize=5 }, null)'>test1</a>
this links works. received search criteria in action page.
now, have button javascript below:
<button id="buttontest2">test2</button> <script language="javascript"> $("#buttontest2").click(function () { document.location = '@url.action("myaction","mycontroller", new searchcriteriaaffaire { page=3, pagesize=5 }, null)'; }); </script>
this button doest' work. mean, didn't receive search criteria in action page , don't know why??
it drives me crazy!
test1 , test2 produces same url (i check in 'view source code' right clicking on html page):
/?sortby=none&page=3&pagesize=5'
any appreciated.
try :
<button id="buttontest2">test2</button> <script language="javascript"> $("#buttontest2").click(function () { document.location = '@html.raw(url.action("myaction","mycontroller", new searchcriteriaaffaire { page=3, pagesize=5 }, null))'; }); </script>
Comments
Post a Comment