我正在尝试使用基于员工 ID 的 ajax 调用在文本框中的 asp x 页面中显示结果。我已将 Sql 查询编写为 Web 方法来获取结果。它返回记录列表<>。我想通过 Sql 查询在输入文本框中使用 JavaScript ajax 调用在 asp x 页面上显示结果。例如 dB 表名称是包含名字、姓氏、电子邮件的员工记录。我想通过 Web 方法中的 Sql 查询获取记录,然后想通过 ajax 调用显示。
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://localhost:12897/Methods.asmx/GetEmployeeById",
data: '{"pid": "' + value + '"}',
dataType: "json",
async: false,
success: function (msg) {
response = true;
$('#testerror').html();// i want query result here in text box with id testerror
$('#confirmModal').modal();
},
error: function (result) {
alert("please try again");
return false;
}
});