2021年3月10日星期三

javascript string action unescaping Url.Action

I have a simple javascript code as follows

var url = '@Url.Action("Action", "Controller", new { id = "_id_", id2 = "_id2_", id3 = "_id3_", id4 = "_id4", ... })';  

used in the ajax calls where idxx is replaced with other values However the var url is generated with "...&id2=id2&..." etc. and i just learned that javascript string.replace() works only on the first occurance

wondering if there's another way to code the var url rather than replace multiple times ?

https://stackoverflow.com/questions/66576310/javascript-string-action-unescaping-url-action March 11, 2021 at 12:05PM

没有评论:

发表评论