javascript - How to pass Id value to window.location.href in MVC application -


currently working on mvc application in need render page action in mvc application need pass id parameter action.

here code.

var cardcode=$('#cardcode').val(); if (str.substr("successfully")) {     window.location.href='@url.action("editpartner","mstpartner",new { id = cardcode})'; } 

in code when passing value id, i.e id=cardcode not allowed there how pass cardcode value action? please give suggestion.

your code doesn't work because can't pass variable in there. works if value hardcoded

window.location.href='@url.action("editpartner","mstpartner",new { id = "123"})'; 

what can use replace method

var cardcode=$('#cardcode').val(); if (str.substr("successfully")) {     window.location.href='@url.action("editpartner","mstpartner",new { id = "cc"})'.replace("cc",cardcode); } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -