错误WCF + AJAX调用(XML Http请求异常101

时间:2012-01-08 00:50:26

标签: jquery ajax wcf xmlhttprequest

我正在尝试获取一个带有ajax调用的数组,以便在我的主页上显示它。我正在使用端口4926的Visual Studio开发服务器。我正在从我的本地WAMP服务器检索我的数据。我可以使用所需的对象填充我的数组。但是当我返回这个数组时,我的Ajax函数出错了。

我的Ajax代码:

getLastTenArticles: function () {
    $.ajax({
        async: false,
        cache: false,
        type: "GET",
        contentType: "application/json",
        url: "../Magazine/Magazine.svc/GetLastTenArticles",
        success: function (data) {
            alert(data);
        },
        error: function (xhr) {
            alert(xhr.statusText);
        }
    });

}

我的WCF接口方法:

[OperationContract]
[ServiceKnownType(typeof(Article))]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
Article[] GetLastTenArticles();

我的登录并获取我的用户数据,但事实并非如此。我用谷歌搜索了一天,但没有遇到任何解决方案:(

感谢任何帮助:)

0 个答案:

没有答案
相关问题