Use the built-in wordpress Ajax actions:
Your jquery will look like this:
$('#ajax_form').bind('submit', function() {
var form = $('#ajax_form');
var data = form.serialize();
data.action = 'MyPlugin_GetVars'
$.post('/wp-admin/admin-ajax.php', data, function(response) {
alert(response);
});
return false;
Your plugin code something like:
add_action("wp_ajax_MyPlugin_GetVars", "MyPlugin_GetVars");
add_action("wp_ajax_nopriv_MyPlugin_GetVars", "MyPlugin_GetVars");
function MyPlugin_GetVars(){
global $wpdb;
// use $wpdb to do your inserting
//Do your ajax stuff here
// You could do include('/wp-content/plugins/test/getvars.php') but you should
// just avoid that and move the code into this function
}
For more info please visit AJAX in Plugins