简体   繁体   中英

How to assign value from javascript return to razor variable?

Here is the example:

<script> function getString(){ var a = "something"; return a;} </script>

and razor example:

string a = "javascript return" or getString();

is that possible?

You wont be able to convert JavaScript variable/function call to a Razor variable. Razor variable is handled by Razor engine on server where as JavaScript on the other hand is a client side language running on the client.

Razor is a view engine used by the ASP.NET MVC framework running on the server to produce some HTML template.

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