0

I am not sure wha is going on here but I am repeatedly receiving this error when trying to use the REST API when saving a form. I make the $.ajax call, wait for the promise to return but at some point the promise gets stuck in the middle and never returns, but instead if I go through enough F10 function in the debugger this is the error I receive. I am at my wits end because I have this working perfectly fine using the same methods on other sites, but this one doesn't seem to want to cooperate.

var promise1, promise2;
var promise_array = [];

if(vm.receivables) {
 promise1 = user.postDealItem(args....).then(function(response) {
           vm.model.recId = response.Id;
           return response
});
}

if(vm.standard) {
 promise2 = user.postDealItem(args...).then(function(response) {
           vm.model.stdId = response.Id;
           return response
});
}

if(promise1 != null) promise_array.push(promise1);
if(promise2 != null) promise_array.push(promise2);

$.when.apply($,promise_array).done(function(response) {
    //never gets to this point
});

The promise never returns even on the few times it reaches a success stage, it just reloads the page. At my wits end over this one, have been dealing with this for the past 2 days and have not gotten any closer to a solution. I am using SP2013 online at my company's site and have angular integrated with it(although I prefer jQuery promises/$ajax methods)

  • Upgrade to IE11 and try again. SharePoint Online has no compatibility guarantee to support IE10. products.office.com/en-US/office-system-requirements/… – Trevor Seward Mar 14 '18 at 15:58
  • Trevor, my mistake I am actually using 11...the issue seems to be it failing on the return from SharePoint because the data is being saved in the list. The most maddening thing is that this works perfectly fine in another site without issues. Now I just got the following 403 error: "The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again." Which again makes no sense since I am getting the FormDigest value directly prior to sending the request(ie, I chain the ajax calls together) – MattE Mar 14 '18 at 16:02
0

In fact the answer was an issue with IE11 that appears intermittently where a post request times out between the send and the receive, so when the post returns, it has nowhere to send the data to---no error, no exception, no nothing most times, just a reload of the page...

I tracked it down by watching th network very closely before it sent and stopped it right before it reloaded. It aborted the XMLHTTPRequest and then I started digging...found that you need to set a few other blank functions in the ajax cal like completed and beforeSend and then put timeout: 0...this somehow prevents IE11 from timing out...worked the first attempt after I did this and every attempt after...

IE is the worst browser ever made, it needs to die a quick painful death.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.