Good I am trying to make a query to a database with AJAX once the user has entered values in 3 input. The query must enter the results in the datalist of a 4th input. The problem I have in the selector, I have done it by nesting them so that if you fill them in 3 order correctly AJAX query but if you do disordered (eg: you enter value for the 2nd input and then for the 1st) does not perform correctly. How do I avoid that?
$("#clinica").on("input", function () {
$("#medico").on("input", function () {
$("#fecha").on("input", function () {
$.get("cambio_fecha.php", { clinicaHora: $('#clinica').val(),
medicoHora: $('#medico').val(),
fechaHora: $('#fecha').val()}, function (data) {
$("#opcionesHoras").empty();
$("#opcionesHoras").append(data);
});
});
});