Hello Drupal,
This is for D6 but the concept applies to other versions as well (We are still on D6 because modules we depend on have yet been ported to D7)
I've been wanting to learn how to do this for a long time but 1) examples I find are not Drupal-related and 2) I get overwhelmed and move on to something else. I've searched the forums here and can't find anything yet. So today I am determined to learn so here goes!
What I'm looking for: I'm trying to find a simple way to use presumably an 'onclick' event to load data from the database.
My Problem: I've seen many tutorials, such as this one http://openenergymonitor.org/emon/node/107, but they always use a separate php file to handle the request. Such as...
$.ajax({
url: 'api.php',
...
And also examples like http://www.tutorialspoint.com/ajax/ajax_database.htm, which do this...
ajaxRequest.open("GET", "ajax-example.php" +
queryString, true);
Both depend on some additional php file and I'm sure I don't need to create a separate file since Drupal already has it's own API and database functions already available to me, so...
My Question: I'd like to learn how to use Drupal's own database functions to display data dynamically using jQuery/AJAX.