Code: Select all
<script type="text/javascript">
// if the user moves down
$(document).ready(function(){
$("#down").click(function(){
$.ajax({
type: "POST",
url: "move.php",
cache: false,
data: {move: "down"},
success: function(html){
$("#"+tile).html(html);
}
});
});
});
</script>
Code: Select all
<?php
include "config/connect.php";
session_start();
$player = $_SESSION['player'];
if (isset($_POST['move'])){
$move = $_POST['move'];
if ($move == 'down'){
mysql_query("Update movement set tile=tile+11 where name='$player'") or die (mysql_error());
$gettingtileinfo = mysql_fetch_array(mysql_query("Select * from movement where name='$player'"));
$tile = $gettingtileinfo['tile'];
echo '<div id="actor1_down"></div>';
}
}
?>
<script type="text/javascript">
var tile = tile_<? echo $tile; ?>;
</script>
btw I already changed this
Code: Select all
$("#"+tile).html(html);
Code: Select all
$("#tile_1").html(html);
any help would be appreciated thanks