mio script restituisce valore indefinito dal mio json_encode phpjson_encode ritorno indefinito
index.php
<?php
$returnThis['user'] = "Robin098";
$returnThis['id'] = "08465";
echo json_encode($returnThis);
?>
sample.html
<head>
<script>
function clickHere(){
$.get("index.php", function(data) {
alert(data.user);
});
}
</script>
</head>
<body>
<input type="button" onclick = "clickHere();" value="ClickHere!"/>
</body>
Come posso risolvere questo problema?
Da dove viene la variabile '$ aReturn' nel tuo script PHP? Si passa da '$ returnThis' a' $ aReturn' senza spiegazione. – Jasper