-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';
 }
?>
0

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

2 Comments

You mean pass the function name as GET or POST method and call in PHP file?
You can pass any perimeter to the PHP file which will indicate it to call the function you want to.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.