2012-08-10 32 views
0

工作,我有一些代碼:

// Setup a content array for the tooltips 
    var Data = []; 
    var search = $("input#field_search").val(); 
    var combo = $("select#search_option").val(); 
    var jsonUrl = "ajax.php?module=formation&action=get_participant_list_json&filter_by="+combo+"&search="+search; 
    $.getJSON(jsonUrl, function(data) { 
     var items = []; 
    alert(data.join(" || ")); //WHAT TO SHOW YOU HERE 

     $.each(data, function(key, val) { 
    //alert(val); 
      items.push(val.replace(/@/gi,"#")); 
     });    
     //console.log(items); 
    //alert(items.join(" || ")); 
     $(".tips").each(function(i){ 
      $(this).simpletip({ content: items[i] }); 
     }); 

    }); 

如果我IE7訪問照片直接:

ajax.php?module=formation&action=get_participant_list_json

ajax.php?module=formation&action=get_participant_list_json&filter_by=&search=

我收到了很好的回覆數據與秩序:

["0Bequart Claire","1AZZI Sarah"] 

但我alert(data.join(" || "));我有reseversed

0AZZI Sarah || 1Bequart Claire 

DO喲知道我有什麼misstake?爲什麼要刷新響應列表的順序?

感謝您的幫助

+0

您應該訪問完整的網址,該網址看起來就像是它的一半 – Alexander 2012-08-10 14:10:08

+0

爲什麼?但我仍然有相同的如果ajax.php?module = formation&action = get_participant_list_json&filter_by =&search = – sophie 2012-08-10 14:11:28

回答

1

我不能完全按照你的代碼,所以我很抱歉,如果我有誤解,但.push貌似旨在實現LIFO堆棧操作。如果您想按照加載它的順序卸載(列出)數組,請使用附加操作加載它,然後使用迭代器卸載它。

+0

alert(data.join(「||」));我沒有做任何推動,但只是警惕 – sophie 2012-08-10 14:14:02

相關問題