I’m make an ajax call to run a file:
var data = 'index=exp' + index;
var go_url = get_bloginfo('template_url') + '/form/exp.php';
$.ajax({
url: go_url,
type: "GET",
data: data,
cache: false
});
The file “exp.php” inserts a new row in mysql database and it works.. but with the ajax call nothing happens. As if he did not open the link.
I think you should add ‘add_action’ for functions in wordpress
like
function yourfunction(){
...
}
add_action('wp_ajax_your_function', 'yourfunction');
add_action('wp_ajax_nopriv_your_function', 'yourfunction');
and in your jquery you can call ‘your_function’ instead of php file
Is the ajax being called?
Try putting it inside of document ready.