Lima
Lima

Reputation: 21

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?

Upvotes: 0

Views: 480

Answers (1)

Satpal
Satpal

Reputation: 133403

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.

Upvotes: 1

Related Questions