CodeIgniter Forums
how call prototype.js from controller ? - 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: how call prototype.js from controller ? (/showthread.php?tid=10040)



how call prototype.js from controller ? - El Forum - 07-17-2008

[eluser]najm[/eluser]
hello

i have problem to call prototype.js in a controller in fact i call this library in view and i success and this is my code


this is the Controller :
Code:
<?php
class Ajax_ci extends Controller{
    function Ajax_ci(){
        parent::Controller();
    }
    
    function index(){
        $this->load->view('ajax_view');
    }
}
?>


and this the view :

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
[removed][removed]


[removed]
    function tester()
{
    monNombre     = 42;
    alert(monNombre.toColorPart());
}

[removed]

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Document sans titre&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<div id="myDiv">
        <p>This is a paragraph</p>
    </div>
    <div id="myOtherDiv">
        <p>This is another paragraph</p>
    </div>

    &lt;input type="button" value="Test $()"&gt;&lt;br/>

&lt;/body&gt;
&lt;/html&gt;

please help to call this library prototype.js from the controller and thank you


how call prototype.js from controller ? - El Forum - 07-17-2008

[eluser]meigwilym[/eluser]
You'll have to call prototype.js from the view, as it's code that's executed in the browser, and not the server.

If you need a quick guide on using JS with CI, take a look at Michael Wales' tutorial:

http://michaelwales.com/tutorials/codeigniter-ajax-with-jquery/

Mei