ASP CLassic JSON标头问题

Any ideas why this is kicking up a fuss for my jquery ajax call.

Sub SetJsonHeader()
    Response.AddHeader "Content-Type", "application/json"
End Sub

something = Request.Form( "formLabel" )
SetJsonHeader()
Response.Write( "{ something: """ & something & """ }" )

The response.write is returning the correct string { something: "blabla" } but when I call it with my javascript it reports an error:

    $.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 + "
" + b + "
" + c);

            // alerts                 
            //     { something: "blabla" }
            //     parse error
            //     syntax error invalid character
        }
    });
查看全部
weixin_33729196
weixin_33729196
2013/03/12 12:24
  • json
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

0个回复