Trying to get my controller and action name in a javascript file -


i'm looking @ link here , anser given is

var controllername = '@viewcontext.routedata.values["controller"].tostring()'; 

but doesn't seem return in javascript file. shows value string '@viewcontext.routedata.values["controller"].tostring()' doesn't compute name.

i had put in view

<script type="text/javascript">     var controllername = '@viewcontext.routedata.values["controller"].tostring()';     var actionname = '@viewcontext.routedata.values["action"].tostring()'; </script> 

i couldn't read in javascript file. 2 variables accessable in js file


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -