2011-10-30 42 views
3

任何人都可以幫我用這個小代碼嗎?我試圖在頁面啓動時加載項目列表,然後當用戶點擊更多項目時,更多項目將逐步加載。使用jquery遞增加載Ajax項目

$(document).ready(function(){ 
    $.get('videos.php', { id: "<?php echo $ID; ?>", start: 0 }, function(data) { 
     $('#list').html(data); 
    }); 
}); 

$('.showmorevids').click(function() { 
    var $input = $('.showmorevids span').attr('id').split('-'); 
    alert(input); 
    $.get('videos.php', { id: input[0], start: input[1], total: input[2] }, function(data) { 
     $('#list').html(data); 
     alert("success"); 
    }); 
}); 

的videos.php頁面將返回的項目清單,並用不同的ID(ID-開始計)一個新的按鈕,這樣我可以使用新的變量了新的要求。當頁面加載時,第一個加載的$ .get很好,但當用戶點擊按鈕時,沒有任何反應,沒有請求被髮送。有人能告訴我我錯過了什麼嗎?

回答