I'm having the following problem: I'm not able to set the value to a input
when it's inside a function
. Example:
$(document).on('click',".edita_cliente", function(){
var id = $(".seq").val();
$.ajax({
url: 'php/lista_clientes.php?service=2&id=' + id,
type: 'get',
dataType: 'json',
success: function (data) {
setTimeout(function(){
$("#content").load('cadastra_cliente.php');
$("#nome_cad").val(data[0].Nome);
}, 700);
}
});
});
This function, when I click the button, it closes the modal, loads the page. But it is not putting the value in
input
. I tried other forms, and I noticed that it does not set any value ininput
when it is withinfunction
. Can anyone explain me why?Thank you in advance!