部分代码:ajax:function changeCity(type,zhishi){
$.ajax({
url: 'cc.php',
type: 'post',
data: "act=ayzs&type="+type,
success: function(oj){
//location.href="cj.php?act=award&wid="+wid+"&cid="+cid;
//location.href="Olympic.php?act=ayzs&type="+type;
openDiv(zhishi); //调用了一个js
}});
}
html页面:
<{foreach from=$arr item=arr}>
<div class="olKbodyCon1">
<p><{$smarty.foreach.fd.iteration}>、<{$arr.OlyTopicContent}></p>
<div class="olsel"><input type="radio" name="xuan" /> A.<{$arr.OlyTopicAnswerA}> <input type="radio" name="xuan" /> B.<{$arr.OlyTopicAnswerB}></div>
</div>
<{/foreach}>
php页面:$type=isset($_REQUEST['type']); //随机选择20道题
$arr1=create_rand($phone,$type); //用了一个自定义函数从数据库读出 显示为数组
$smarty->assign("arr",$arr1);
$.ajax({
url: 'cc.php',
type: 'post',
data: "act=ayzs&type="+type,
success: function(oj){
//location.href="cj.php?act=award&wid="+wid+"&cid="+cid;
//location.href="Olympic.php?act=ayzs&type="+type;
openDiv(zhishi); //调用了一个js
}});
}
html页面:
<{foreach from=$arr item=arr}>
<div class="olKbodyCon1">
<p><{$smarty.foreach.fd.iteration}>、<{$arr.OlyTopicContent}></p>
<div class="olsel"><input type="radio" name="xuan" /> A.<{$arr.OlyTopicAnswerA}> <input type="radio" name="xuan" /> B.<{$arr.OlyTopicAnswerB}></div>
</div>
<{/foreach}>
php页面:$type=isset($_REQUEST['type']); //随机选择20道题
$arr1=create_rand($phone,$type); //用了一个自定义函数从数据库读出 显示为数组
$smarty->assign("arr",$arr1);
我用ajax刷新了一块页面,在。php页面读取数据库得到一个数组,我怎么传到html页面呢?
success: function(oj){
$(".xx").html(data);
}
success: function(oj){
$(".xx").html(oj);
}
exit(json_encode($arr1));
query的ajax的type那块编程json就可以直接调用oj了