Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to call javascript function from Controllers file in MVC
Posted
Updated 6-Apr-11 20:05pm
v2

I guess, calling javascript from controllers class is not possible.

Exact same question asked here: http://stackoverflow.com/questions/4284618/how-to-call-javascript-function-from-controllers-file-in-mvc[^]

Have a look at more discussion of above thread here confirming it cannot be done:
http://stackoverflow.com/questions/2709978/call-javascript-from-mvc-controller-action[^]
 
Share this answer
 
There is one way you can call javascript function from controller. Not directly but going through view.

Just pass the name of your javascript function to view from controller using model and then you can call it from view using document.ready provision of jquery.


HTH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900