ASP CLassic JSON头问题

时间:2013-03-12 12:24:54

标签: jquery ajax json asp-classic

任何想法为什么这会让我的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
        }
    });

0 个答案:

没有答案