使用来自sharepoint列表的angularjs和REST api获取数据时出错

时间:2014-04-16 12:41:44

标签: javascript angularjs sharepoint

我定期使用sharepointangularjs列表中提取数据。有一段时间后,我在控制台中收到错误SCRIPT7002: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff.我使用IE 10作为浏览器。有关此错误的任何想法?

请找到我反复拨打以下方式获取数据的方法。

// Method to get all the notifications for the user
    var getUserNotifications = function () {

        // Create a deferred object
        var deferred = $q.defer();

        // Url for getting the list with filters
        var url = _spPageContextInfo.webServerRelativeUrl +
                "_api/web/lists/getByTitle('" + list + "')/items?" + filters;

        // API call to get the notification items from list 
        var method = $http({
            method: "GET",
            url: url,
            headers: {
                "Accept": "application/json;odata=verbose"
            }
        });

        // Executing the method
        method.then(

            // Success function
            function (data) {

                var d = data.data.d.results;

                notification = d;


                // If timer is not started, then start it.
                if (!isTimerStarted) {

                    setInterval(function () {

                        getUserNotifications();

                    }, 3000);

                    isTimerStarted = true;
                }
        deferred.resolve(d);

            },
            // Error
            function (err) {
                deferred.reject("Error");
            }
        )
        return deferred.promise;
    };

0 个答案:

没有答案