I have a form with the list of clients. When selecting the client, I want it to automatically fill in the address, number, neighborhood and city fields.
I have Ajax, but I do not know how to work out the return of it.
var id = $('#cliente').val();
$.ajax(
{
url:"ajax/endereco/" + id,
success:function(result) {
$('[name="servicos[0].endereco"]').val(result.endereco);
$('[name="servicos[0].numero"]').val(result.numero);
$('[name="servicos[0].bairro"]').val(result.bairro);
$('[name="servicos[0].cidade"]').val(result.cidade);
}
}
);
I would like to know how to be able to import the data that comes from this address ... or how to display the data, what would his PHP be like? Thanks guys.