<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
$("#txt_nome_assinante").autocomplete({
source: function (request, response) {
$.ajax({
url: 'retornarInteressado.aspx',
data: JSON.stringify({ txt_interessado: $("#txt_nome_assinante").val() }),
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("#cod_interessado_assinante").val(i.item.val);
},
minLength: 1,
appendTo: $('#txt_nome_assinante_container')
});
});
</script>
<table>
<td class="td_primeira">
<b>NOME:</b><br />
<div class="position-absolute" id="txt_nome_assinante_container">
<input type="text" name="txt_nome_assinante" id="txt_nome_assinante" value="<% =txt_nome_assinante %>" >
</div>
</td>
</table>
</body>
</html>
Como deveria ficar