Results 1 to 2 of 2

Thread: It's a Race!

  1. #1
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default It's a Race!

    I am pretty sure I am creating a race but I do not know how to go about fixing it... any ideas?

    cheers,

    PHP Code:
    $('.add-items').live('click', function(evt) {
            if (
    evt.button != 0) return; // ignore right-click
            
    evt.preventDefault();
            
            var 
    items = $(this).attr('href').substr(1).split(',');
            
    // now items is ['G400180', 'G400181']
            
            // Disable the link to prevent repeated orders
            
    $(this).attr('disabled','disabled');
            
            
    // Execute the orders using ajax
            
    var remaining_requests_cnt items.length;
            for (var 
    0items.lengthi++) {
                $.
    ajax({
                    
    url'/cgi/cart.cgi?'+items[i],
                    
    success: function() {
                        if (--
    remaining_requests_cnt == 0) {
                            
    top.location.href="http://www.feelgoodlightups.com/cgi/cart.cgi?viewcart";
                        }
                    },
                    
    error: function() {
                        
    alert('Error occurred. Check the content of your cart.');
                        
    location.reload();
                    },
                })
            }
        }); 

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    What is a race? What is the goal of this project?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •