Magento Prototype How to create Ajax request queue

Dear Friends,

Here is the small Prototype hack to create ajax queue?

First you need to create a Class with functions

initialize :

To initialize all the global variables that your going to use

add : 

Function to add a new request into the queue

push:

Function to process one by one request from queue

Here is the code sample for creating Ajax request queue in prototype

Here is how to call Ajax request queue with multiple request

First you need you create class object for the class

Then add one by one request into queue

Where to use?

Yes, you can use this to implement Ajax add to cart Functionality in Magento, Chat system, or any type or request that you need to process one by one with out page refresh.

Thank you for reading, if you like please share and comment, I will be posting more hacks soon.

Have a great coding !!!

The following two tabs change content below.

Arshad M

Magento Certified Developer at Codilar
Passionate full stack eCommerce web developer, Magento Certified Developer.

Latest posts by Arshad M (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *