我正在尝试从对话框确认 Jquery UI 调用 VB 方法。问题是 chrome 从服务器显示 500 错误。我究竟做错了什么?
谢谢
客户端:
<script>
function asyncServerCall(userid) {
jQuery.ajax({
url: 'WebForm2.aspx/GetData',
type: "POST",
data: "{'userid':" + userid + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert(data.d);
}
});
}
$(function () {
$("#dialog-confirm").dialog({
resizable: false,
height: 250,
modal: true,
buttons: {
"Delete all items": function () {
asyncServerCall("test");
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
</script>
服务器端
<WebMethod()> _
Public Shared Function GetData(userid As String) As String
'You can do database operations here if required
Return "my userid is" & userid.ToString()
End Function