Greetings, I'm starting to use ajax technology to send data JSON type to a php sheet to make an insert to the database, in a facebook login the code works perfect unless you show me error 404 not found if I use this code js from an ibicacion in a different directory "dominio.com/ofertas/descuento" for example, now well: I have my JS that is activated from the index, and sends the data to /facebook/facebookusers.php and registers but what happens if the user is in another part of the page, in another directory, let's say it is in offers / deals, ... there the route that I have in my $ .POST of AJAX does not work for me
QUESTION, there is a method or way to use a "generic" location so that from any location on the page the $ .POST is sent correctly
function saveUserData(userData){
$.post('facebook/facebook-user.php', {oauth_provider:'facebook',userData: JSON.stringify(userData)}, function(data){ return true; }).done(function(data){
reloadPage();
});
console.log(userData);
}
the code works fine if I run from index.php but if the location changes, that is from another location example: ofertas.php I want to login, I can not do it, error 404 not found. since the route does not match