tags:

views:

313

answers:

2

When creating and executing a ajax request queue with $.manageAjax, I call ajaxManager.abort();, to abort the entire queue due to error, at which time I get an error stating q[num] has no properties (jquery.ajaxmanager.js line 75) here is the calling code:

var ajaxManager = $.manageAjax({manageType:'sync', maxReq:0});
// setup code calling ajaxManager.add(...)

// in success callback of first request
ajaxManager.abort(); <-- causes error in jquery.ajaxManager.js

there are 4 requests in the queue, this is being called in the success of the first request, if certain criteria is met, the queue needs to be aborted.

Any ideas?

A: 

It looks like you've got fewer items in q than you were expecting when you started iterating. Your script may be trying to access q[q.length], i.e. the element after the last element.

Could it be that your successful request has been popped from the queue, and you have a race condition? Are you trying to abort a request that has already completed its life cycle? Alternatively, have you made a silly mistake as people sometimes do, and got your loop termination condition wrong?

Just a few thoughts, I hope they help.

Lucas Richter
+1  A: 

Hi Sean, thanks for the tick. I'm curious as to what the actual problem was, because I suggested a few possibilities there. Did you narrow it down?

Lucas Richter