Skip to content

jusbuc2k/jquery-ajaxq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery-ajaxq

Simple message queue for jQuery.ajax()

Usage

Same options as jQuery.ajax().

<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script src="ajaxq.js"></script>
<script>
    // Req 1 should run immediately
    $.ajaxq({
        url: 'http://www.example.com/1',
        type: 'GET'
    }).then(function(response){
        console.log(response);
    });

    // Req 2 should not run until req 1 is done
    $.ajaxq({
        url: 'http://www.example.com/2',
        type: 'GET'
    }).then(function(response){
        console.log(response);
    });

    // Req 3 should not run until Req 2 is done.
    $.ajaxq({
        url: 'http://www.example.com/3',
        type: 'GET'
    }).then(function(response){
        console.log(response);
    });
</script>