So I have this problem for a while now, and I know there are countless questions on this topic, believe me I tried every solution possible but still does not work.
T
Try to edit your code and use:
$.ajax({url: 'ajax/add-user.php',
type: 'POST',
data: {name: 'John'},
dataType: 'html',
success: function(data){
alert("success");
console.log(data);
},error: function (xhr, ajaxOptions, thrownError) {alert("ERROR:" + xhr.responseText+" - "+thrownError);}
});
(so you will receive an error & success alert, ensure is html what you receive.those extra parameters will help you to fine-tune your ajax calls. Later play with async true/false)
also, run your program ajax/add-user.php in a new window (type the url) and see what it echoes.Edit the program and force to echo you something "i.e. legendary hello world" and see if your ajax receive the message.
Good luck.