CodeIgniter Forums
loading a view through javascript - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: loading a view through javascript (/showthread.php?tid=4809)



loading a view through javascript - El Forum - 12-17-2007

[eluser]breaddes[/eluser]
i've create template modules that i want to load into a website actively using javascript. is it possible to call a view that way? i am working with prototype and scriptaculous.


loading a view through javascript - El Forum - 12-17-2007

[eluser]Nick Husher[/eluser]
You need to create a controller that will configure and serve those view files. The javascript can't directly manipulate data on the server, so you have to play a game of telephone with it a little bit.


loading a view through javascript - El Forum - 12-17-2007

[eluser]breaddes[/eluser]
thanks for your response. can i call a controller function by javascript?


loading a view through javascript - El Forum - 12-17-2007

[eluser]nmweb[/eluser]
Sure, no problem.


loading a view through javascript - El Forum - 12-17-2007

[eluser]breaddes[/eluser]
the thig is that i don't want to load a bunch of html modules by default. i want to load them just in time, when they're needed.


Code:
window.onload = function(){
    $('login').onclick = function(){
            
       //here is where want to load a certain view actually    
       fadein('dialog', 1);
       fadein('overlay', 0.8);
    }
}