Why do I receive a q[num] error when aborting a jQuery queue pipeline?

Tags: ajax jquery
Question!

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?



Answers

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.



I'm not aware of anyone who keeps track of this publicly on a regular basis (unlike Adobe who pushes it every chance they get). The closest that I could come was this article from last November. Based upon his site, this data could be skewed a bit, but I think we fairly similar numbers as well.

By : jsight


Disclaimer: I work for Atalasoft

Our OCR module supports Tesseract and if that proves to not be good enough, you can upgrade to a better engine and just change one line of code (we provide a common interface to multiple OCR engines).



This video can help you solving your question :)
By: admin