Forum Moderators: open

Message Too Old, No Replies

call php script from library onclick

trying to call a php funcion from a library onclick using js

         

MrWhippy

3:00 pm on Aug 11, 2008 (gmt 0)

10+ Year Member



Hi all,

is it possible to call a php function from a library using javascript, i am trying to do this in a form, using the submit button.

any help much appreciated thanks.

Fotiman

5:56 pm on Aug 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes and no. :)

You can't simply call a PHP function since PHP is processed server-side and JavaScript is processed client-side. You could, however, make an AJAX request to a PHP page, and have that PHP page return only the results of your function.

MrWhippy

6:43 pm on Aug 11, 2008 (gmt 0)

10+ Year Member



yeah i knew they worked differently i didnt want to put the script in its own page if you like i wanted it to be in a library,

thanks for the help

khucthuydu

11:49 pm on Aug 14, 2008 (gmt 0)

10+ Year Member



please use Ajax.

MrWhippy

8:01 am on Aug 15, 2008 (gmt 0)

10+ Year Member



K thanks, khucthuydu.

ill have a look at that,