How to put Jquery Ajax request with priority

I have a web page with multiple ajax requests to load SVG preview images. On the same page, I have several buttons that use ajax to load the content used in the jquery dialog.

My problem is the jquery dialog's loading time is too long because other requests have not completed.

I would like to know if it is possible to cancel the whole request in order to send the priority request and when it is done I will send the rest?

When the page is ready, a request to load the SVG is sent. If the user clicks a button to load the dialog, the request to load the contents of the dialog should take precedence.

thanks for the help

+3


source to share


1 answer


Here is an example jQuery Priority Queue plugin:

http://benalman.com/code/projects/jquery-message-queuing/docs/files/jquery-ba-jqmq-js.html

or to maintain a list of waiting calls / callbacks. Or nesting the next call in the previous callback, you can look at IO



https://developer.yahoo.com/yui/3/io/#queue

There is also a brilliant answer explained by Serial ajax requests

+2


source







All Articles