I have this online RPG where a user gets to battle a computer control opponent. A new turn is supposed to be started after the computer or user uses an attack/item. but a new turn is not started within the page. For some reason the only way the battling works is if I refresh the page and I want all battling to happen in 1 page.

My host is GoDaddy.

Can you find the problem with the script? BTW the game is in a separate folder, does that have anything to do with it?
Code:
<script type="text/javascript" src="../attack/javascript/attack.js"></script>
  <script language="JavaScript">

  var speler_attack; var timer; var next_turn_timer; var attack_timer = 0; var speler_wissel;

  function show_end_screen(text){
    $.get("attack/wild/wild-finish.php?aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(), function(data) {
      request = data.split(" | ");
      if(request[0] == 1) $("#message").html("<?php echo $txt['you_won']; ?> "+text);
      else if(request[0] == 0){
        $("#message").html("<?php echo $txt['you_lost']; ?> ");
        if(request[1] > 0) $("#message").append("<?php echo $txt['you_lost_1']; ?>"+request[1]+" Silver. ");
        $("#message").append("<?php echo $txt['you_lost_2']; ?>");
      }
      setTimeout("location.href='ingame.php?page=attack/attack_map'", 1000);
    });
  }

  //If div is ready
  $("#message").ready(function() {
    //Write Start Text
    if("<? echo $aanval_log['laatste_aanval']; ?>" == "spelereersteaanval"){
      speler_attack = 1
      speler_wissel = 1
      $("#message").html("<?php echo $txt['you_first_attack']; ?>")
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "computereersteaanval"){
      speler_attack = 0
      speler_wissel = 0
      $("#message").html("<? echo $computer_info['naam_goed'].' '.$txt['opponent_first_attack']; ?>")
      setTimeout('next_turn()', 200)
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "pokemon"){
      speler_attack = 0
      next_turn()
      $("#message").html("<? echo $computer_info['naam_goed'].' '.$txt['opponents_turn']; ?>")
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "computer"){
      speler_attack = 1
      $("#message").html("<?php echo $txt['your_turn']; ?>")
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "wissel"){
      speler_attack = 0
      speler_wissel = 1
      $("#message").html("<? echo $pokemon_info['naam_goed'].' '.$txt['have_to_change']; ?>")
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "end_screen"){
      speler_attack = 0
      speler_wissel = 0
      show_end_screen("<?php echo $txt['next_time_wait']; ?>")
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "klaar"){
      speler_attack = 1
      $("#message").html("<?php echo $txt['fight_finished']; ?>")
      setTimeout("location.href='ingame.php?page=attack/attack_map'", 1000)
    }
    else if("<? echo $aanval_log['laatste_aanval']; ?>" == "gevongen"){
      speler_attack = 1
      $("#message").html("<?php echo $txt['success_catched_1'].' '.$computer_info['naam_goed'].' '.$txt['success_catched_2']; ?>")
      setTimeout("location.href='ingame.php?page=attack/attack_map'", 1000)
    }
    else $("#message").html("Error: 0001\nInfo:<? echo $aanval_log['laatste_aanval']; ?>")
  });

  //Change attack status
  function attack_status(msg){
    request = msg.split(" | ")
    var time = 750
    if(request[7] < 25) time = 750
    else if(request[7] < 50) time = 750
    else if(request[7] < 100) time = 750
    else if(request[7] < 150) time = 750
    else if(request[7] < 200) time = 750
    else if(request[7] < 250) time = 750
    else if(request[7] >= 250) time = 750

    if(request[5] == 1) leven_verandering(request[2],request[4],request[3])
    attack_timer = setTimeout("attack_status_2('"+msg+"');", time)
  }

  function attack_status_2(msg){
    clearTimeout(attack_timer)
    request = msg.split(" | ")

    $("#message").html(request[0])
    if(request[4] == "pokemon"){
      life_procent = Math.round((request[2]/request[3])*100)
      $("#"+request[8]+"_life").width(life_procent + '%')
      $("#"+request[8]+"_leven").html(request[2])
      $("#"+request[8]+"_leven_max").html(request[3])
      $("div[id='change_pokemon'][name='"+request[9]+"']").attr("title", "<? echo $pokemon_info['naam']; ?> \nLife:"+request[2]+"/"+request[3]+"");
    }

    if(request[4] == "pokemon"){
      if(request[2] == 0) speler_wissel = 1
      else{
        speler_attack = 1
        speler_wissel = 1
      }
    }
    else{
      speler_attack = 0
      speler_wissel = 0
    }

    //Computer make next turn
     if(request[1] == 1) next_turn()
    else if(request[6] == 1){
      setTimeout("exp_change("+request[11]+","+request[12]+");", 1000)
      setTimeout("show_end_screen('"+request[10]+"');", 1000)
      speler_attack = 0
      speler_wissel = 0
    }
  }

  //Change Pokemon Function
  function change_pokemon_status(msg){
    //Get php variables
    request = msg.split(" | ")
    //Send message
    $("#message").html(request[0])
    //Stop Life Change
    clearTimeout(timer);
    //Change was succesfull
    if(request[1] == 1){
      //Change Pokemon in fight name, level and attacks
      $("#pokemon_naam").html(request[3])
      $("#pokemon_level").html(request[4])
      $("button:eq(1)").html(request[5])
      $("button:eq(2)").html(request[6])
      $("button:eq(3)").html(request[7])
      $("button:eq(4)").html(request[8])
      //Create image for new pokemon in fight
      if(request[14] == 1){
        var map = "shiny"
        $("#pokemon_star").show()
      }
      else{
        var map = "pokemon"
        $("#pokemon_star").hide()
      }
      $("#img_pokemon").attr("src","images/"+map+"/back/" + request[15] + "<? echo $fitim; ?>");
      //Show all pokemon in your hand
      $("div[id*='change_pokemon'][name*='1']").show()
      $("div[id*='change_pokemon'][name*='2']").show()
      $("div[id*='change_pokemon'][name*='3']").show()
      $("div[id*='change_pokemon'][name*='4']").show()
      $("div[id*='change_pokemon'][name*='5']").show()
      $("div[id*='change_pokemon'][name*='6']").show()
      //Hide the new pokemon that is in fight
      $("div[id*='change_pokemon'][name*='"+ request[9] +"']").hide()
      //Change the HP Status from new pokemon in fight
      var pokemon_life_procent = Math.round((request[10]/request[11])*100)
      $("#pokemon_life").width(pokemon_life_procent+'%')
      //Change EXP Status from new pokemon in fight
      var exp_procent = Math.round((request[12]/request[13])*100)
      $("#pokemon_exp").width(exp_procent+'%')
      //Computer make next turn
      if(request[2] == 1){
        speler_attack = 0
        speler_wissel = 0
        next_turn();
      }
      else{
        speler_attack = 1
        speler_wissel = 0
      }
    }
  }

  //Use item function
  function use_item_status(msg){
    //Get php variables
    request = msg.split(" | ")
    //Send message
    $("#message").html(request[0])
    //change amount of item
    var option = $("option[title="+request[5]+"][name="+request[3]+"]")
    //Set New Amount
    var amount = request[2]
    //If Amount is smaller than 1, amount -> 0
    if(request[2] < 1) {
      amount = 0;
      option.css({ backgroundColor : "silver" })
    }
    //Change tekst
    option.html(option.val() + " ("+amount+")")
    //It was a potion
    if(request[5] == "Potion"){
      //The pokemon in fight life has to change
      if(request[8] == 1) leven_verandering(request[6],'pokemon',request[7])
      //Potion screen has to go away
      $("#potion_screen").hide()
      //Calculate new life for pokemon
      var green = Math.round(request[6]/request[7]*100);
      //Set new life for potion screen
      $("#"+request[11]+"_green").width(green + 'px')
      $("#"+request[11]+"_red").width(100-green + 'px')
      $("#"+request[11]+"_leven").html(request[6])
      //Change pokemon change field title
      $("div[id=change_pokemon][name="+request[9]+"]").attr("title", request[10] + " \nLife: " + request[6] + "/" + request[7])
      //Computer make next turn
      if(request[1] == 1){
        speler_attack = 0
        speler_wissel = 0
        next_turn()
      }
    }
    else if(request[5] == "Pokeball"){
      speler_attack = 0
      speler_wissel = 0
      //Computer make next turn
      if(request[1] == 1) next_turn()
      //Attack finished
      else setTimeout("location.href='?page=attack/attack_map'", 2000)
    }
  }

  //Try To Run Function
  function attack_run_status(msg){
    //Get php variables
    request = msg.split(" | ")
    //Send message
    $("#message").html(request[0])
    if(request[1] == 1) setTimeout("location.href='?page=attack/attack_map'", 2000)
    //Computer make next turn
    if(request[1] == 0){
      speler_attack = 0
      speler_wissel = 0
      next_turn()
    }
  }

  //Make Computer Do Attack
  function next_turn(){
    clearTimeout(next_turn_timer)
    next_turn_timer = setTimeout('computer_attack()', 1000)
  }

  //Player Can Do Stuff
  $(document).ready(function(){
    //Player Do Attack
    $("button[id='aanval']").click(function(){
	    if(speler_attack == 1){
        if($(this).html() != ""){
          speler_attack = 0
    			$("#message").html($("#pokemon_naam").html()+" <?php echo $txt['did']; ?> "+$(this).html()+".")
    			$("#potion_screen").hide()
    			//alert($(this).html())
    			$.ajax({
    			  type: "GET",
    			  url: "attack/wild/wild-do_attack.php?attack_name="+$(this).html()+"&wie=pokemon&aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(),
    			  success: attack_status
    			});
  			}
  		}
    });

    //Player Make Change Pokemon
    $("div[id='change_pokemon']").click(function(){
      if(speler_wissel == 1){
        if(($(this).attr("name") != "") && ($(this).attr("title")) != "Egg"){
          $("#potion_screen").hide()
          $.ajax({
            type: "GET",
            url: "attack/attack_change_pokemon.php?opzak_nummer="+$(this).attr("name")+"&computer_info_name=<? echo $computer_info['naam']; ?>&aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(),
            success: change_pokemon_status
          });
        }
      }
    });

    //Player Using Item
    $("button[id='use_item']").click(function(){
      if(speler_attack == 1){
        if($('#item').val() == "Kies") $("#message").html("<?php echo $txt['no_item_selected']; ?>")
        else if($('#item :selected').attr("title") == "Potion"){
          $("#item_name").html($('#item').val())
          $("#message").html()
          $("#potion_screen").show()
        }
        else if($('#item :selected').attr("title") == "Run"){
          if(speler_attack == 1){
            $("#potion_screen").hide()
            $.ajax({
              type: "GET",
              url: "attack/wild/wild-attack_run.php?computer_info_name=<? echo $computer_info['naam']; ?>&aanval_log_id=<? echo $aanval_log['id']; ?>&sid="+Math.random(),
              success: attack_run_status
            });
          }
        }
        else{
          $("#potion_screen").hide()
          $.ajax({
            type: "GET",
            url: "attack/wild/wild-attack_use_pokeball.php?item="+$('#item').val()+"&computer_info_name=<? echo $computer_info['naam']; ?>&option_id="+$('#item :selected').attr("name")+"&aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(),
            success: use_item_status
          });
        }
      }
    });

    //Player is Using Potion
    $("button[id='use_potion']").click(function(){
      if(speler_attack == 1){
        if($("input[name='potion_pokemon_id']:checked").val() == undefined) $("#message").html("<?php echo $txt['potion_no_pokemon_selected']; ?>")
        else{
          $.ajax({
            type: "GET",
            url: "attack/attack_use_potion.php?item="+$("#item_name").html()+"&computer_info_name=<? echo $computer_info['naam']; ?>&option_id="+$('#item :selected').attr("name")+"&potion_pokemon_id="+$("input[name='potion_pokemon_id']:checked").val()+"&aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(),
            success: use_item_status
          });
          $("#potion_screen").hide()
        }
      }
    });
  });

  //Computer Do Attack
  (function($){
    computer_attack = function() {
      if(speler_attack == 0){
        $("#message").html("<?php echo $txt['busy_with_attack']; ?>")
        $("#potion_screen").hide()
        $.ajax({
          type: "GET",
          url: "attack/wild/wild-do_attack.php?attack_name=undifined&wie=computer&aanval_log_id="+<? echo $aanval_log['id']; ?>+"&sid="+Math.random(),
          success: attack_status
        });
      }
    };
  })(jQuery);