CodeIgniter Forums
Help: Calling a Javascript function from within a view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Help: Calling a Javascript function from within a view (/showthread.php?tid=52083)



Help: Calling a Javascript function from within a view - El Forum - 05-29-2012

[eluser]Unknown[/eluser]
I'm very new to CI and JS. I'm trying to call a Javascript function from within a view but I can't get this to work.

Code:
<?php foreach ($address as $address_item): ?>

    <scrpt>codeAddress("&lt;?php echo $address_item['Address2'] ?&gt;");</scrpt>
    
&lt;?php endforeach ?&gt;

The JS function is defined inthe header template. Any help would be much appreciated.


Help: Calling a Javascript function from within a view - El Forum - 05-29-2012

[eluser]Aken[/eluser]
What's the problem or error? Have you tried using a Javascript console to look for any errors (such as Firebug for Firefox or the JS console built into Chrome or IE)?


Help: Calling a Javascript function from within a view - El Forum - 05-30-2012

[eluser]bassie[/eluser]
Did a suggestion here for <scrpt> with an i but see that's removed by formum software.
Explains the notation.