asp.net mvc - Why we have to use quotation for c# code in java script (Razor) -


consider code:

'@url.action("getusers","cash")' 

if use out quotation ,above code work.

why should use quotation c# code in java script ?

if want pass url javascript variable - yes. because url string.

try not add quates , recieve next line in javascript:

var test = /cash/getusers; 

javascript interpreter systaxerror: invalid regular expression because regular expressions in javascript can begin / symbol.


Comments