ik heb de volgende code:
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("change").click(function(){
// Get value from input element on the page
var numValue = $("#num").val();
// Send the input data to the server using get
$.get("attack_map/ajax_call/change.php", {id: numValue} , function(data){
// Display the returned data in browser
$("#result").html(data);
});
});
});
</script>
<?php
$sqlBattle = $connect->runQuery("SELECT * FROM users_battle WHERE user_id = '".$connect->clearText($getUserdata->id)."'");
while($row = $connect->FetchObject($sqlBattle)){
?>
<input type="hidden" id="num" name ="num" value="<?php echo $connect->Filter($row->id); ?>" />
<button type="change"><img src="images/<?php echo $connect->Filter($row->_id); ?>.gif" height="32px" width="32px" /></button>
<?php
}
?>
<div id="result">
</div>
Echter geeft die op welke button ik ook klik, altijd het ID 1 aan...
change.php
<?php
include("../../inc/global.php");
// Check online
// Check in FIGHT
// blabla..>?
//
$id = $_GET['id'];
echo $id;
?>
Hoop dat iemand mij kan helpen, alvast bedankt!