javascript - Using jquery variable in Razor -


i have table in there input buttons attribute data. want read value of attribute , pass on razor's routeurl.

my jquery function:

$('#table').on("click", "input.myclass", function () {     var abc = $(this).attr('data');     var myroute = @url.routeurl("routename", abc)-- > says abc not defined         //use myroute   }); 

what have experience can't use js variable in razor vica vera possible.

so have achieve doing this:

var myroute = '@url.routeurl("routename")';  myroute = myroute +"/"+ abc; 

suppose route rendered routeurlhelper is:

var myroute =   '/home/about'; var abc = 1; 

concatenate value it:

 myroute = myroute +"/"+ abc;// --->  /home/about/1 

Comments