Search code examples
phpjavascriptajaxyui

How to call a PHP function from JS that is invoked when clicking a link?


I have this test page:

http://www.comehike.com/hikes/uncancel_hike.php?hike_id=30

When clicking "yes" I am able to get the JavaScript function invoked named uncancelHike, but I don't really know how to call the PHP function.

I do import a php script with a function named uncancelHike() but I am not certain how to call it from that Javascript.

I do use YUI in the code, but not sure if I should be using it here, or this is something much simpler.


Solution

  • You need to use AJAX here, this tutorial should helpful for you:

    Beginning AJAX Using The YUI Library