消息“:”无效的Web服务调用,缺少参数值:\ u0027fff \ u0027。“,”StackTrace

时间:2013-01-18 07:29:27

标签: asp.net

我有一个js file.a希望使用ajax将值作为json传递给我的代码隐藏但是我收到此错误: 消息“:”无效的Web服务调用,缺少参数值:\ u0027fff \ u0027。“,”StackTrace

我的javascript代码是:

var values = { fff: "tttttttt" };
var uname = "fariddddddd";
  $.ajax({
 type: "GET",
 url: "http://localhost:39787/Default.aspx/dataSave",
 data: JSON.stringify(values),
 contentType: "application/json; charset=utf-8",
 dataType: "json",
 processData: false,
 success: function (msg) {
     AjaxSucceeded(msg);
 },
 error: function (msg) {
     alert(msg);
 }
     });

我的代码背后是:

[WebMethod(true)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string dataSave(string fff)  
 {
   string a = fff + "kazemi";
   return a;

}

请帮帮我

1 个答案:

答案 0 :(得分:1)

你没有用引号括起Key。将声明更改为这样。阅读此UnQuoted Object in javascript

var values = { "fff": "tttttttt" };