jquery脚本是printng "
和,
为什么?用jQuery打印php数组值?
php脚本:
<?php
session_start();
include 'classes/datahandle.class.php';
$data = new Datahandle();
$query = "SELECT i.instructionValue FROM INSTRUCTION_INPUT i WHERE i.deviceId = '$_SESSION[deviceId]' AND i.instructionState = '1' ORDER BY inputPortNumber";
$inputResult = $data->selectDataQuery($query);
while ($inRow = mysql_fetch_array($inputResult)){
$array[] = $inRow[0];
}
header("Content-type: text/plain");
echo json_encode($array);
?>
jQuery脚本:
<script>
$(document).ready(function() {
var refreshId = setInterval(function() {
$.get('response.php', function(data) {
$.each(data, function(index, value) {
$('#value'+index).html(value).show();
});
});
}, 3000);
$.ajaxSetup({ cache: false});
});
</script>
HTML:
<tbody><tr style="color: white; font-weight: bold;">
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value0">[</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value1">"</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value2">1</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value3">1</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value4">"</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value5">,</td>
</tr>
<tr>
<td style="text-align: center; color: white; font-weight: bold;" id="value6">"</td>
</tr>
</tbody>
你的问题是什么? – 2011-05-04 15:24:09
为什么jQuery不在每个html id中正确地打印来自php数组的值?目前正在印刷“,并且int的凸轮是分开的... – obinoob 2011-05-04 15:27:59
@ FCC-PT:你能明确地表明你得到了什么,以及你期待什么吗? – mellamokb 2011-05-04 15:30:59