ASP.NET アプリケーションで AJAX を介して、文字列配列と文字列配列の配列の両方を Web サービスに渡すことができる必要があります。しかし、私は得続けます
{"Message":"Invalid object passed in, : or } expected. (16): { basicInfo:\"[\"TESTCO\",\"TESTCO\",\"PO BOX 0\",\"My City\",\"MyState\",\"My Zip\",\"MyPhone\",\"TEST1 - TEST, TEST3 - TEST, \",\"11/15/2012\",\"16:36\",\"myname\",\"1202160021\"]\"}","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}
私は、JSON とシリアライゼーション、およびそのすべてについてよく理解していません。ですから、自分が何を間違っているのか本当にわかりません。
var cvwOther = new Array();
var equipAssign = new Array();
var qAndA = new Array();
var binfo = new Array(storeinfo[2], storeinfo[6], storeinfo[7], storeinfo[8], storeinfo[9],
storeinfo[10], storeinfo[11], storeinfo[12], getToday(), getNow(), userinfo[0], call);
function submitCVW(call) {
db.transaction(function (tx) {
tx.executeSql("Select * From CVWOther Where CallNumber=?", [call], function (tx, result) {
var i = 0;
$.each(result.rows, function () {
cvwOther[i] = result.rows.item(i);
i++;
});
}, onSQLError);
tx.executeSql("Select * From EquipAssign Where CallNumber=?", [call], function (tx, result) {
var i = 0;
$.each(result.rows, function () {
equipAssign[i] = result.rows.item(i);
i++;
});
}, onSQLError);
tx.executeSql("Select * From CVW Where CallNumber=?", [call], function (tx, result) {
var i = 0;
$.each(result.rows, function () {
qAndA[i] = result.rows.item(i);
i++;
});
$.ajax({
type: "POST",
dataType: "json",
contentType: "application/json",
url: "MyService.asmx/CVW",
data: '{ basicInfo:"' + JSON.stringify(bInfo) + '", cvwOther:"' + JSON.stringify(cvwOther) + '"}',
success: function(data) {
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
}, onSQLError);
});
}
Web メソッド署名
[WebMethod]
public void SubmitCVW(string[] basicInfo, string[][] cvwOther)