3
I got the following ajax
:
var id = $('#idCliente').val();
$.ajax(
{
url:"/Administrar/chamadas/ajax/endereco/" + id,
dataType : 'json',
success:function(result) {
$('[name^="cham_endereco[]"]').val(result.endereco);
$('[name^="cham_numero[]"]').val(result.numero);
$('[name^="cham_cidade"]').val(result.cidade);
$('[name^="cham_bairro"]').val(result.bairro);
}
});
In this case I recover the customer address data, to automatically fill in the fields, the return is this way:
{"address":"R MANDAGUARI","neighborhood":"25","city":"1","state":16,"cep":83324410,"numero":"1316","capital":true}
Until the return, all right. However, in the system I use a select to select first the city and then yes the neighborhood... In this case, selects the city automatically, however, the neighborhood is not selected (because it is not loaded by an ajax).
How can I call the neighborhood in ajax, so that automatically click on the screen and select the neighborhood that is being requested?
From what I understand, you have the neighborhood in the return of Ajax but it does not load in html, this?
– Diego
Exactly, I have this neighborhood comeback... But I need to elaborate some jquery that loads these neighborhoods... by the following, in the field below, when you select the city, the neighborhood comes. (works) but in the case of the city already selected, does not give the onchange to carry the neighborhoods... understood? :)
– Sr. André Baill
Take a look at this code, I used it here. It is not difficult to adapt to your: http://answall.com/questions/99107/listar-states-bairros-formulário-de-cadastro/99133#99133
– Diego