Reputation: 14694
I have the folowing problem, I have a Javascript war and need to pass it into a RazorView statment like this:
<script type="text/javascript">
var myID = ...
@MyREazorCall(myID);
</script>
I get the message: "myID" is not available in this context
how to solve this?
Upvotes: 0
Views: 86
Reputation: 898
Since the RazorView statement is executed on the server before the Javascript, you will probably have to alter your solution to allow the Javascript to run a ajax request and then your View/Controller will have to respond to that ajax request and then you handle the response in the Javascript.
Upvotes: 4