ajax web服务调用无效 参数值,asp.net - “消息”:“无效的Web服务调用,缺少参数值:\ u0027 - 堆栈内存溢出...

当我从jQuery向WebMethod发送2个参数并使用多个参数时,我收到此错误。

{"Message":"Invalid web service call, missing value for parameter: \u0027haha\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}

在jQuery中:

$(".txtNoiDung").focusout(function () {

$.ajax({

type: "POST",

url: "QuanLyTin.aspx/test1cai",

data: JSON.stringify({ hahas: $(this).val(),tuans: "hahaha" }),

contentType: "application/json; charset=utf-8",

dataType: "json",

success: function (msg) {

$("#vltxtNoiDung").text(msg.d)

},

error: function (xhr, reason, ex) {

alert(reason);

}

});

});

在代码背后

[WebMethod()]

public static string test1cai(string haha, string tuan)

{

return "Hi, "+haha + tuan;

}

我该如何解决? 谢谢你们。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值