问题是没有出现警告消息“TEST”,尽管该函数getData.php
已成功执行并返回了一些数据。我在 Firelog 中检查了它,在那里我可以看到以下输出:
Array{"arr":[["1","EZY14ZM","2013-05-29 16:44:38","2013-05-29 16:45:28"],["1","VLG1307","2013-05-29 16:47:05","2013-05-29 16:47:55"],["1","WZZ212","2013-05-29 16:49:12","2013-05-29 16:50:02"]],"dep":[["1","VLG8306","2013-05-29 16:59:17","2013-05-29 17:00:00"],["1","VLG3786","2013-05-29 17:07:29","2013-05-29 17:08:12"],["1","IBE1851","2013-05-29 17:08:38","2013-05-29 17:09:21"],["1","DLH58Y","2013-05-29 17:09:47","2013-05-29 17:10:30"]]}
如何解决这个问题呢?
function show_data() {
$.getJSON(
'h_index.php?module=mod_1&pag_mod=getData.php',
function(data) {
alert("TEST");
}
);
}
获取数据.php
<?php
//...
echo json_encode(array('arr' => $rows_arr, 'dep' => $rows_dep););
die();
?>