I wrote a wordpress plugin witch appends some comment functions in my template. Via ajax all the stuff should be transmitted into the wordpress database.
The problem is - the ajax handler needs a php file with captures the query via
if(isset($_POST['name'], $_POST['title'], $_POST['description'])) {
// do something with wordpress actions, e.g. get_current_user, $wpdb
}
At the time the user transmits the query the ajax handler calls the php file like this:
$('#ajax_form').bind('submit', function() {
var form = $('#ajax_form');
var data = form.serialize();
$.post('../wp-content/plugins/test/getvars.php', data, function(response) {
alert(response);
});
return false;
The getvars.php doesn't know the wordpress environment because it is called directly from user submit and I think to add the wordpress environment classes and includes is not the good style.
Is there any other way? Thanks for support.