[wp-hackers] ajax to call function in theme

Sharon Chambers sharon at BrewerRadio.com
Thu Oct 29 19:47:00 UTC 2009

Realized that was a bit lacking...
Here's my simple test code following the AJAX tutorial in the codex (http://codex.wordpress.org/AJAX_in_Plugins):

$vote = $_POST['vote'];
$results_id = $_POST['results_div_id'];

global $wpdb;
$results = 'db prefix: '. $wpdb->prefix;

die( "document.getElementById('$results_id').innerHTML = '$results'" );

The above produces empty string for prefix:  db prefix: 

More information about the wp-hackers mailing list