I have given file name like “counter.php” in “URL” of ajax code that file is located in wordpress root directory but its giving error of file not found. Kindly check the code detail. How should i add the ajax code in wordpress and file in root directory .
Network Error: 404 Not Found – http://localhost/wordpress/list/counter.php
this is my AJAX code
jQuery.ajax({
type: "POST", //by post method
url: "counter.php", // file name
data: { id: ID },
success: function(data){
alert(data);
}
});
you haven’t given the path correctly of the file counter.php and you must have to include the database connection in that file..