任何想法为什么这会为我的 jquery ajax 调用大惊小怪。
Sub SetJsonHeader()
Response.AddHeader "Content-Type", "application/json"
End Sub
something = Request.Form( "formLabel" )
SetJsonHeader()
Response.Write( "{ something: """ & something & """ }" )
response.write 正在返回正确的字符串 { something: "blabla" } 但是当我用我的 javascript 调用它时它会报告一个错误:
$.ajax({
dataType: "json",
url: "includes/Process.asp",
method: "POST",
data: {
process: "notrelevant",
formLabel: something
},
success: function (data) {
alert(data);
$(obj).replaceWith(data.casName);
},
error: function (a, b, c) {
alert(a.responseText + "\n" + b + "\n" + c);
// alerts
// { something: "blabla" }
// parse error
// syntax error invalid character
}
});