-1

Possible Duplicate:
Call PHP Function using jQuery AJAX
Call php function from javascript

I need

callPhpFnc("myPhp"); // javascript function

how can i call the php function with myPhp as function name.

in my php file

<?php
 function myPhp()
 {
     echo 'Hello';
 }
?>
Community
  • 1
  • 1
Nevin
  • 205
  • 1
  • 4
  • 12

2 Answers2

1

Its not possible my dear. Coz your php is runned once at server side before the page is loaded. But the javascript at client side. Option is to use the ajax.

Mujtaba Haider
  • 1,650
  • 2
  • 19
  • 29
0

You cant call a PHP function by JS.You have to use ajax for this.

techie_28
  • 2,123
  • 4
  • 41
  • 62