<script>
$(function(){
dataparam={"app_id":<?=$CYCLE_NO?>};
$.ajax({
type: ‘POST‘,
dataType: "json",
url: ‘ajax/getappinfo.php‘,
cache: false,
data:dataparam,
success: function(data)
{
$.each(data,function(idx,item){
var pro_id=item.PRO_ID;
// $("#pro_id").val(item.FACT_QTY);
var a = document.getElementsByTagName("div");
var dom;
for(var k = 0,kk=a.length;k<kk;k++){
if(a[k].getAttribute("data-np-id") == pro_id){
dom = a[k];
break;
}
}
dom.getElementsByTagName("input")[0].value=item.FACT_QTY;
})
}
});
})
</script>
//php
<?
include_once ("inc/auth.inc.php");
$id = isset($_POST[‘app_id‘]) ? $_POST[‘app_id‘] : ‘0‘;
$query = "SELECT * FROM office_transhistory WHERE CYCLE_NO=".$id;
$cursor = exequery ( TD::conn (), $query );
$data="[";
while ( $ROW = mysql_fetch_array ( $cursor ) )
{
$PRO_ID = $ROW[‘PRO_ID‘];
$FACT_QTY = $ROW[‘FACT_QTY‘];
$data.="{\"PRO_ID\":\"".$PRO_ID."\",\"FACT_QTY\":\"".$FACT_QTY."\"},";
//$data.="{\"".$PRO_ID."\":\"".$FACT_QTY."\"},";
};
$data=substr($data,0,-1);
$data.="]";
file_put_contents("D:/txt.txt",$data);
echo $data;