How to call Javascript function in PHP?

How to call a php function from javascript?

  • Answer:

    Hi mani! U cant call a php function from a javascript. Javascript is a client side scripting language. That is, it is executed on ur browser. Whereas, PHP is a server side scripting language. That is, it runs on the server's PHP interpreter, and the PHP interpreter generates a HTML page dynamically and sends it to ur browser. So, u cant call a PHP function from Javascript.

Mani at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

PHP is server-side, and javascript is client-side. Thereby, PHP is interpreted before javascript. PHP can write javascript functions into a page, but if javascript writes PHP code onto a page, it will not be interpreted by the PHP engine. P.S. Yes, Technology is all about "yes you can", but that doesn't say HOW you can. Yes, you can always find a way to create what you want, but you must follow certain rules (especially in programming) in order to get there. Not being able to call PHP from javascript is one of thoes rules. It's like trying to change the color of the paint after something has already been painted.

TheJim01

Okey i do agree with the above answears but i dissagree withe the CAN't./ By the way can you be more specific as what whould you like to do maybe there is another way to it .. thank you. TECHNOLOGY is alwasy YES YOU CAN.

Tim S

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.