get the value of Global variable in javascript example var a="priti"

so want to access "a" in code behind as it's global varible

share|improve this question

2 Answers

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.