I have some custom menu defined for which in the page callback function I want to execute some javascript function defined in some js file which is included in .info file.
The alert and console.log works as file is included on the page and loading successfully in browser, but custom js function not working. It says function is not defined.
.info file:
scripts[] = js/code_init.js
Here is my code in .module file:
function mymod_process_file(){
$count = 2;
for($i = 1; $i <= $count; $i++) {
$file_path = "/abcd.html";
echo "counter:$i";
echo "<script language='javascript' type='text/javascript'>";
echo "myFunction('".$file_path."', 'index_".$i."');";
echo "</script>";
}
return 1;
}