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
Post a Comment