0

新しいページが表示されたら、スクリプトを実行したいと思います。そうすること:index.html(リンク):

<a href="games.html" data-transition="slide"><img src="./images/1.jpg" alt="" width='100'/></a>

games.htmlにありますが、このコードは実行されません。

$(document).ready(function(){
            update_list_games();
        });

および機能:

function update_list_games(gamer_id)
{
            requestToServer(prefix_server + 'load_games_list.php?gamer_id=' + gamer_id, function(response){
                if (response.data != null)
                {
                    if (games_list == "")
                    {
                        for (i = 0; i < response.data.length; ++i)
                        {
                            games_list += "<li class='my_li' onClick=get_game("+i+")><a href='#page3'><img align='left' src='images/"+response.data[i].icon+"' height='45' width='45' style='padding:10px;'/><h3>"+response.data[i].name+"</h3><p>"+response.data[i].description+"</p></li>";
                        }
                        $("#games_list").append(games_list); 
                        $('#games_list').listview('refresh');
                        $('#games_list').addClass('my_li');
                    }
                }
                else
                {
                    alert(MES_ERR_SERVER_ACCESS);
                }
    });

}

これどうやってするの?

4

1 に答える 1

0

関数はパラメーター (gamer_id) を必要としますが、パラメーターなしで呼び出します。また、別のスコープ (グローバル?) で宣言されているように見える関数で使用される他の変数 (fe prefix_server) と (requestToServer) と呼ばれる関数もあります。

于 2012-08-14T14:15:02.977 に答える