Tuesday 10 February 2015

How to Call a javaScript function in PHP

You can't call a javascript function in PHP directly.

But You can Call a Javascript function from outputted HTML by PHP. It means you can call the javaScript function on conditional. See Example Below:
$count= empty($_GET['count'])?0:$_GET['count'];
    echo '<script>callFunc1()</script>';
echo '<script>callFunc2()</script>';
echo '<script>callFunc3()</script>';

In this way, we call the JavasScript function in PHP.