i am wounding if i can do this, as i am trying this from last 2 days but no success.
i want to run java script function from php
like
php example
<div id="meprocess"></div>
<?php
for($i=1;$i<=10;$i++)
{
?>
<script>
jfun(<?php echo $i;?>);
</script>
<?php
}
?>
java script
<script type="text/javascript">
function jfun(n)
{
html="Loop is on" + n;
$("<div>"+ html +"</div>").appendTo("div#meprocess");
}
</script>
i am trying to generate a page which print loop number one by one....
but i got error jfun is not defined.
what i can understand my be java script function is not ready at the time of php execution. is there any way round, like running the php loop when DOM/Page is ready so that java script function will be ready that time, or any other way round....
Thanks