EDIT: fixed _ typo (2x), added header, still logging 100.
Upon clicking a button in my JavaScript, I'm firing this function (parameter: 100)
ajaxManager = new AjaxManager();
ajaxManager.requestHexContent(100);
function AjaxManager (){
this.requestHexContent = function(id){
$.ajax({
type : 'get',
url : 'simulator/hexFiller.php',
dataType : 'json',
data: {
gameid: id,
},
success : function(ret){
console.log(ret);
},
error : function(){
alert("error")
}
});
},
}
this is my hexFiller.php
<?php
header('Content-Type: application/json');
$ret;
if (isset($_GET["gameid"])){
if ($_GET["gameid"] == 100){
$ret = 200;
}
else {
$ret = "error";
}
}
echo json_encode($ret);
?>
Now, what i would expect to happen is for my browser to log "200" to the console, or, "error". Instead it logs "100" to the console.
Can someone explain to me the fundamental error in my thinking?