I have a “little” problem because I don’t know whats the best way to handle ajax jquery database request?
So far I’ve done it this way:
For ever (single) database request I created a new .php file like:
newbill.php
newcosumer.php
listallbills.php
updatecostumer.php
..and so on and pull the data via:
$.ajax({
type: "POST",
url: "ajax/newbill.php",
data: "..."
success: function(msg){
...
}
});
..what I don’t like is all the .php files for only ONE! database request!?
There must be a better way to handle this??
I would do it in this way.
Create a php file for each entity (Ex : consumerajax.php , billajax.php,etc…) then have seperate functions for each of your database queries.When calling from the javascript pass a querystring variable to determine which function to be executed in the ajax server page
Ex : In consumerajax.php
and from your scrip call like
or