XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff.

Leave a Comment
Hello Everyone ,
In a following post we will see how to resolve "XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff. " error.I got this error while I am developing SharePoint hosted Apps .

I am using REST API to get the values from the List, code as follows,
function getItems_List(SPAppWebUrl, SPHostUrl) {
    var url = SPAppWebUrl + "/_api/SP.AppContextSite(@target)" + "/web/lists/getbytitle('ListName')/items?" + "@target='" + SPHostUrl + "'";
    var executor = new SP.RequestExecutor(SPAppWebUrl);
    executor.executeAsync({
        url: url,
        method: "GET",
        headers: { "Accept": "application/json;odata=verbose" }, // return data format
        success: onQuerySuccess,
        error: onQueryError
    });
}
There is invalid mime or bad character set being sent with our json data causing the error.Adding the charset like this helped me to resolve the issue.

Resolution:
function getItems_List(SPAppWebUrl, SPHostUrl) {
    var url = SPAppWebUrl + "/_api/SP.AppContextSite(@target)" + "/web/lists/getbytitle('ListName')/items?" + "@target='" + SPHostUrl + "'";
    var executor = new SP.RequestExecutor(SPAppWebUrl);
    executor.executeAsync({
        url: url,
        method: "GET",
        headers: { "Accept": "application/json;odata=verbose;charset=utf-8" }, // return data format
        success: onQuerySuccess,
        error: onQueryError
    });
}

Thanks.

Related Post

0 comments:

Post a Comment