AJAX Assessment

See the comments for instructions

HTML

<script src="//code.jquery.com/qunit/qunit-1.15.0.js"></script>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.15.0.css">
<body>
    <div id="qunit"></div>
    <div id="qunit-fixture"></div>
</body>

JavaScript

//Name: Your Name Here
//Date: 00/00/00

/*
 * Please be sure to hit the Fork button at the top before you begin
   working to ensure we can locate your solution.
 * Hit update when done and send the new url.

 * Write a function, fillCart, that does the following:
 
     * Accepts a shoppingList as a comma-delimited list of item names 
       to get, and a callback to be used once all the items have 
       been retrieved.
     
     * For each item in the shopping list, it:
       * Makes an AJAX request to '/items/:itemName' i.e. '/items/carrots'
       * Creates an Item object from the JSON returned by the AJAX request
       * Puts that Item into an array, in the order of the original 
         shopping list
     
     * Once it has the data for all items in the shopping list,
       it calls completeCallback, passing completeCallback the array 
       of Items.
     
 * jQuery 1.11.0 available
 * AJAX requests may take different amounts of time
 * Item constructor defined below
 */
function fillCart(shoppingList, completeCallback) {
    //write this function
    shoppingList = shoppingList.split(",");
    var result = [];
    
    /*function fetchData(shoppingItem)
    {
        
    }
    for(var i = 0;i<shoppingList.length;i++)
    {
        s1 = $.ajax('/items/'+shoppingList[0]);
        
        
    }*/
    var s1 = $.ajax('/items/'+shoppingList[0]);
    var s2 = s1.then(function(res) {
        result.push(new Item(res.label,res.price));
        console.log("works fine");
        var pro = $.Deferred();
        
        var s2p = $.ajax('/items/'+shoppingList[1]);
        
        s2p.then(function(res) {
            pro.resolve(res);
        });
        
        return pro.promise();
    });
    
    var s3 = s2.then(function(res) {
        result.push(new Item(res.label,res.price));
        console.log("works fine");
        var pro = $.Deferred();
        
        var s3p = $.ajax('/items/'+shoppingList[2]);
        
        s3p.then(function(res)...