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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -