3
I have a form with the client list. When selecting the customer, I want you to automatically fill in the address, number, neighborhood and city fields.
I have Ajax, but I don’t know how to elaborate on his return.
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 import the data that comes from this address... or how to display the data, what would PHP look like? Thank you guys.
What gives you
success:function(result) { console.log(result);
?– Sergio
It doesn’t print anything. But if I give an Alert(id), it will print the ID that I pass to it... what I am not knowing how to develop, is PHP, which displays these results...
– Sr. André Baill
Already have something in PHP? how is the query you are doing?
– Sergio
No... actually, I’ve assembled the Ajax module now... to see if I can get to this result... But I have no idea how to put in the codeigniter...
– Sr. André Baill