File path not getting in ajax “URL” in wordpress. Showing error of 404.?

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

Read More

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);
    }
});

Related posts

1 comment

  1. you haven’t given the path correctly of the file counter.php and you must have to include the database connection in that file..

Comments are closed.