access javascript global variable from codebehind in asp.net
get the value of Global variable in javascript example var a="priti"
so want to access "a" in cod开发者_JAVA技巧e behind as it's global varible
What you call code behind executes on the server and it cannot access javascript variables. One way would be to pass the value of this variable in a HTML form so that it is included the next time you submit it or send it via AJAX. Depending on what you are trying to do there might be other possibilities.
Since javascript is executed on client side to use the values in javascript you need to send it to server side, you can do so using Page Methods.
精彩评论