0
Display.php
:问题用的getJSON或PHP
<?php
include 'sql.php';
$dataget = mysql_query("SELECT `user`,`message`,`timestamp` FROM `messages`");
$arr = array();
while ($dataarr = mysql_fetch_assoc($dataget)){
$arr[] = $dataarr;
}
echo json_encode($arr);
?>
Index.php
:
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.getJSON('display.php', function(data) {
alert(data.0.user);
});
});
</script>
试图提醒data.0.user
。
+1,但我不明白你最后的陈述。因为'1.'与'1.0'或'1'一样有效。 – Joe
@IAbstractDownvoteFactory我的意思是连续变量字符 – cwallenpoole