This tutorial demonstrates how to execute an external PHP function by clicking a simple link within HTML. The method uses AJAX so that the page doesn’t refresh and doesn’t require a form submission.
1) Paste the following code into a .js file. For demonstration purposes, we have named it “ajax_click.js”.
/*
* ajax_click.js
* chriscook.me
*/
function loadurl(dest) {
try {
// [...]