Inside a subdirectory of my plugin I have a file called insertproducts.php and I need to call that through an Ajax request. I have something like this:
$.ajax({
url: "insertproducts.php",
}).done(function(data) {
console.log(data);
});
But the script cannot find the file and tries to look for:
http://example.com/wp-admin/insertproducts.php
Looking around to find out the problem and I read that WP points all the ajax requests to admin-ajax.php.
How do I run my custom url now?