Click here to Skip to main content
Sign Up to vote bad
good
See more: MVCApplication
how to call javascript function from Controllers file in MVC
Posted 6-Apr-11 19:58pm
Edited 6-Apr-11 20:05pm


2 solutions

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[^]
  Permalink  
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
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,959
1 Prasad_Kulkarni 3,671
2 OriginalGriff 3,359
3 _Amy 3,332
4 CPallini 2,925


Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 14 Apr 2011
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid