【发布时间】:2016-06-29 03:59:02
【问题描述】:
我需要将 ajx 调用中的参数传递给 vb.net 中定义的函数。
函数定义为:
<System.Web.Services.WebMethod()> _
Public Shared Function wwww(ByVal id As String) As String
Return "jhgfjhf"
End Function
Ajax 调用如下:
var l = window.location;
var base_url = l.protocol + "//" + l.host;
$(".pagen ").click(function () {
var num = $(this).attr('id');
alert(num);
$.ajax({
type: "POST",
url: base_url + '/Album%20Viewer%20web/albumlist.aspx/wwww',
data: { id:num },
dataType: 'json',
async: false,
cache: false,
contentType: "application/json",
success: function (response) {
console.log(response);
},
error: function (jqXHR, textStatus, errorThrown) {
if (typeof (console) != 'undefined') {
console.log(errorThrown);
}
else { alert("something went wrong"); }
}
});
});
使用此代码导致内部服务器错误。如果我删除参数部分(使用的数据:{} 和公共共享函数 wwww() 作为字符串),那么它会正常工作。那么我该如何传递参数?
【问题讨论】:
标签: c# jquery ajax vb.net parameters