function s() {
data = "192,273,182,347,13,34,52,2524";
var jsondata = $.toJSON(data);
$.ajax({
type: "POST",
url: "index.aspx/s",
data: jsondata,
contentType: "application/json; charset=utf-8",
dataType: "text json",
beforeSend: function (xhr) {
xhr.setRequestHeader("Content-type",
"application/json; charset=utf-8");
},
success: function (msg) {
if (msg.d == "OK") {
//WIN!
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (typeof (errorThown) != "undefined")
alert("ERROR: SaveWidgetSettings() " + textStatus + '\n' + errorThrown);
else {
var errdetail = eval("(" + XMLHttpRequest.responseText + ")");
alert("ERROR: SaveWidgetSettings() " + textStatus + '\n' + errdetail.Message);
}
}
});
問題を次のようにデバッグしました。
cannot convert object of type 'system.string' to type 'system.collections.generic.idictionary 2 system.string system.object '
コンマが文字列を台無しにしていますか?