The structure of the project is as follows:
The form.js document is responsible for collecting the relevant data from the web page and sending it to form.php , which will manipulate that data and send an email to a specific person.
The thing is that the URL that should connect form.js to form.php via ajax fails. This is the corresponding code:
$.ajax({
type: "POST",
url: "../php/form.php",
data: datos,
success: function (res) {
if (parseInt(res) == 1) {
$(".alert-enviar-3").css('display', 'block');
} else {
$(".alert-enviar-2").css('display', 'block');
}
},
error: function (res) {
$(".alert-enviar-2").css('display', 'block');
}
});
The URL works fine if we put form.php in the same folder as form.js and write the URL "./form.php". However, the URL that you can see in the code fails . Why? Thanks.