简体   繁体   中英

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 code 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.

由于javascript在客户端执行以使用javascript中的值,因此您需要将其发送到服务器端,因此可以使用Page Methods来实现

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM