小编tua*_*t89的帖子

"消息":"无效的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"}
Run Code Online (Sandbox Code Playgroud)

在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);
            }
        });
    });
Run Code Online (Sandbox Code Playgroud)

在代码背后

 [WebMethod()]
        public static string test1cai(string haha, string tuan)
        {
            return "Hi, …
Run Code Online (Sandbox Code Playgroud)

asp.net jquery

10
推荐指数
1
解决办法
3万
查看次数

"消息":"无效的Web服务调用,缺少参数值:\ u0027haha\u0027

我是Jquery Ajax的新手.我需要你的帮助.我想在span元素旁边显示一个文本.我已经完成了一些主题的参考,但我无法解决它

这是我在firebug中的错误(添加了换行符和缩进)

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

在aspx中

<asp:TextBox ID="txtNoiDung" runat="server" TextMode="MultiLine" CssClass="txtNoiDung"></asp:TextBox><span id="vltxtNoiDung"></span>
Run Code Online (Sandbox Code Playgroud)

在代码背后

  [WebMethod()]
    public static string test1cai(string haha)
    {
        return haha;
    }
Run Code Online (Sandbox Code Playgroud)

在Javascript中

$(".txtNoiDung").focusout(function () {
        var dataToSend = { names: $(this).val() };
        $.ajax({
            type: "POST",
            url: "QuanLyTin.aspx/test1cai",
            data: JSON.stringify(dataToSend),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net ajax jquery

4
推荐指数
1
解决办法
4245
查看次数

标签 统计

asp.net ×2

jquery ×2

ajax ×1

javascript ×1