I have 3 buttons in my html page, say ADD, UPDATE & DELETE. And I have written a PHP class DBComm in a PHP file dbutils.php which contains three functions add(), update() & delete() for adding, updating & deleting data in the database.
What I want to do is, on submission of the page, I want to create an instance of the PHP class and would be able to call the corresponding PHP function in that class. I wrote the AJAX code,
xmlhttp.open("POST", "dbutils.php", true);
But, if I write like this, I may need to use three php files for handling each event, like Add.php, Update.php & Delete.php. Is there any option in AJAX for creating an instance of the class and to invoke a particular function in that class so that I can keep all the related things in the same place, ie in the class itself?
you can send parameters with xmlhttp
on the php side in dbutils file you can use your function. for example