WebMethod を呼び出す次の関数 (Jquery) があります。
$(function () {
$('.view-details').click(function (e) {
e.preventDefault();
$('#ticket-id').text("Ticket id: " + $(this).closest('tr').children().eq(1).html());
$.ajax({
type: "POST",
url: "Default.aspx/PopulatePopUp",
cache: false,
data: "{'arg':'" +$(this).closest('tr').children().eq(1).html()+"'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg)
{
alert(msg.d);
}
});
WebMethod はデータベースを呼び出し、SqlDataReader を使用して文字列を取得します。基本的に、返された値からポップアップにテキスト ボックスを設定する必要があります。ただし、アラートには未定義が表示されます。