I need to call a javascript function from my controller in codeigniter.It is possible in codeigniter ?
Problem Details
My javascript file contains
function debugOutput(msg) {
alert (msg);
}
and also I need to call it from my controller.
I done it as follows.
<?php
function check()
{
header('Content-type: application/x-javascript');
// body here
}
?>
function execute() {
debugOutput("<?php echo 'test'; ?>");
}
execute();
But it is not working.Please help me to solve it.
Finally I got the answer.Here I am sharing that answer;
This script will invoke an external javascript function showName().
Thanks for all help me in my trouble.