0
<WebMethod()> Public Shared Function micro() As String
    Dim context As HttpContext = HttpContext.Current
    Dim ClientID As String = context.Session(const_SESSION_CLIENT_ID)
    Dim UserID As String = context.Session(const_SESSION_USER_ID)

    If (ClientID Is Nothing OrElse UserID Is Nothing) Then Return SerializeErrorMessage("User not logged in")

    Dim serializer As JavaScriptSerializer = New JavaScriptSerializer()
    serializer.MaxJsonLength = Integer.MaxValue    

    Dim s As String = U.Settings(ClientID, UserID)

    'Return serializer.Serialize(s).ToString()
    Return s.ToString()
End Function

s 返回我想要的字符串,但是当我从客户端获取并发出警报时,我得到 [object Object]

客户端:

datsaa = {};
    $.ajax({
        type: "POST",
        url: "v.aspx/micro",
        data: datsaa,
        contentType: "application/json; charset=utf-8",
        dataType: "text json",
        beforeSend: function (xhr)
        {
            xhr.setRequestHeader("Content-type",
                         "application/json; charset=utf-8");
        },
        success: function (b)
        {
            alert(b);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown)
        {

        }
    });
4

1 回答 1

1

您将在 bd 中获得字符串,有关详细信息,请阅读此内容

success: function (b)
{
      alert(b.d);
}
于 2012-06-29T17:53:44.220 回答