我的ajax代码没有将值传递给我的webservice方法..我想我没有正确地使用它。请指导我。jquery ajax代码没有将值传递给webservice方法
这是我的.aspx代码:
$(function() {
$.ajax({
type: "POST",
url: "WebService.asmx/InsertRediretTime",
data: "{ 'ReachTime': '21-Nov-11', 'Destination': 'location' }",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data, status) {
alert(data.d);
}
});
});
,这是我的web服务方法提前
public static void InsertRediretTime(string ReachTime, string Destination)
{
//operational code
}
感谢
您是否尝试删除par中的引号ameter名称在JSON中?例如:data:“{ReachTime:'21 -Nov-11',Destination:'location'}”, –