我有一个游戏,我想为它保存高分。
这就是我现在正在做的事情:
  /* high score stuff */
  var score = 0;
  var highscore = 0;
  var scoreelement = $('#highscoredisplay');
  //showing high score
  function calchighscore(){
    highscore = $.get('highscore');
    $.ajax({
        url:'index.html',
        type: 'get',
        dataType: 'html',
        success: function(data){
            jQuery('#highscoredisplay')
        }
    //set score to wincount
    score = wincount;  
    if(score > highscore){
        highscore = score;
    }
    showscore();
  }
我的 ajax 调用不起作用,这是因为我不知道如何进行适当的调用。现在我可以随着胜利的增加而增加我的高分,但是高分在退出游戏后没有保存。
谁能帮我吗?我想我需要在我的高分显示上使用 get 但我不知道如何。我一直在搜索很多例子,但我找不到我正在寻找的东西,或者我只是不明白我在寻找什么......
提前致谢!