I am a rookie PHP developer.
I have created a PHP web project with an HTML page that contains an \'Add\' button. The name of the page is awards.html. The awards.html
There is a method that I have discovered. Please read my explanation completely to continue. In your ajax code (I think you use jQuery), include another info 'perform', with value = php function name.
$.post("something.php", {
something1: something1value,
something2: something2value,
perform: "php_function_name"
});
Then, in your PHP file, add this piece of code at the beginning :
Then, when you call using ajax, you can get a particular function executed.
Example Usage :
Javascript :
$.post("example.php", {
name: "anonymous",
email: "x@gmail.com",
perform: "register"
}, function(data, status) {
alert(data);
});
PHP file example.php:
When you do this, automatically, function register() will get executed.