user1069516
user1069516

Reputation: 463

How to queue Jquery Ajax request with priority

I have a web page with multiple ajax request to load SVG preview pictures. On the same page I have some buttons that use ajax to load content used by jquery dialog.

My problem is that loading time of jquery dialog is too long because others requests are not finished.

I would like to know if it is possible to cancel all request in order to send the priority request and when it's done I resend the others ?

When the page is ready, the request to load SVG are send. If user click on a button to load a dialog, the request for load content of the dialog must be executed in priority.

Thanks for your help

Upvotes: 3

Views: 3193

Answers (1)

Tushar Gupta
Tushar Gupta

Reputation: 15923

Here's an example of a jQuery priority queue plugin:

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

or for maintaining a list of pending calls / callbacks Or nesting the next call in the previous callback, you can have a look at IO

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

Also there is a brilliant answer explained Sequencing ajax requests

Upvotes: 2

Related Questions