0

なぜ自分の状態がうまくいかなかったのか理解できない

$('#resPage').live('pageshow', function(event) {

    application.previousButton();

    //get pdf
    var text = '';
    var value;
    var get = application.readGet();
    switch(get['id']){
        case '1':
            var patt = /annales/g;
            var cutLen = 20;
            break;
         case '2':
             var patt = /copies/g;
             var cutLen = 19;
             break;
    }
    $.ajax({
        url:application.api+'/ressources',
        success:function(data){
            text = "<ul data-role='listview' data-inset='true' >"
            data = JSON.parse(data);
            for(elem in data.files){
            console.log(elem)
            console.log(patt.test(data.files[elem]));
            if(patt.test(data.files[elem])){
                console.log('add');
                value = data.files[elem].substr(1);
                text += application.textRelLink(value,cutLen);
            }
        }   
        text +="</ul>" 
        $('#resPage .content').html(text);
        $('#resPage .content ul').listview();
        }
    })
});

私のログには次のものがあります。

03-02 11:03:14.722: D/CordovaLog(23226): 0
03-02 11:03:14.722: D/CordovaLog(23226): false
03-02 11:03:14.722: D/CordovaLog(23226): 1
03-02 11:03:14.722: D/CordovaLog(23226): false
03-02 11:03:14.722: D/CordovaLog(23226): 2
03-02 11:03:14.722: D/CordovaLog(23226): true
03-02 11:03:14.722: D/CordovaLog(23226): 3
03-02 11:03:14.722: D/CordovaLog(23226): true
03-02 11:03:14.730: D/CordovaLog(23226): 4
03-02 11:03:14.730: D/CordovaLog(23226): true
03-02 11:03:14.730: D/CordovaLog(23226): 5
03-02 11:03:14.745: D/CordovaLog(23226): false
03-02 11:03:14.745: D/CordovaLog(23226): 6
03-02 11:03:14.745: D/CordovaLog(23226): false

しかし、私はtrueの場合に追加したことはありません

助けてくれてありがとう

編集:

解析前のデータ値

03-02 11:25:05.253: D/CordovaLog(23611): {"files":[".\/thumbs\/pdf\/methodo\/sdsdfsd_sdf.pdf",".\/thumbs\/pdf\/methodo\/test!!.pdf",".\/thumbs\/pdf\/annales\/ddfgdfg.pdf",".\/thumbs\/pdf\/annales\/big.pdf",".\/thumbs\/pdf\/annales\/test.pdf",".\/thumbs\/pdf\/copies\/test.pdf",".\/thumbs\/pdf\/poly\/gdfhf.pdf"],"dirs":[".\/thumbs\/pdf\/poly\/",".\/thumbs\/pdf\/copies\/",".\/thumbs\/pdf\/annales\/",".\/thumbs\/pdf\/methodo\/"]}
4

1 に答える 1