【发布时间】:2012-05-21 21:39:43
【问题描述】:
我正在通过 ajax 调用调用 Web 服务,看起来像 -
$.ajax({
cache: false,
type: 'POST',
url: 'renderDisplay.asmx/displayElements',
dataType: 'json',
data: object,
success: function () {
alert ("success"); },
error: function (response) {
alert("error: " + response.responseText);}
});
我的网络服务功能-
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, string> temp = new Dictionary<string, string>();
temp.Add("boston", "mass");
string json = serializer.Serialize((object)temp);
return json;
我得到的错误 -
注意:左括号“
error: (<)?xml version="1.0" encoding="utf-8"?>
(<)string xmlns="http://tempuri.org/">{"boston":"mass"}</string>
【问题讨论】:
标签: c# asp.net ajax web-services response