0
Hello, I have the following script, autocomplete:
<script type="text/javascript">
$(document).ready(function () {
$(".nomeCliente").autocomplete({
source: function (request, response) {
$.ajax({
url: "/PreVenda/CarregarCliente",
type: "POST",
dataType: "json",
data: { nome_razao: request.term },
success: function (data) {
response($.map(data, function (item) {
return {
label: item.nome_razao,
value: item.nome_razao,
id: item.id
};
$("id_cliente").val(data.id);
}))
}
})
},
messages: {
noResults: "", results: ""
}
});
})
</script>
I would like to know how to put the ID in a Hidden
You want to put the id of the selected item or all?
– Randrade
When I select the item, it loads the ID of the selected item in Hidden
– Alysson bormann
That one
$("id_cliente")
would be what? Besides this selector being wrong (lack.
or#
) He’s never run 'cause he’s got areturn
before. You can show the HTML you have and explain better what you want to happen?– Sergio
I need at the time I select the client name in my textbox, it automatically plays the client ID in a Hidden I used $("#id_client"). val(data.id); but I can’t put the client ID in Hidden
– Alysson bormann