在后台是这样写的: //弹窗
public function popups(){
//弹窗
if (Request::instance()->isPost()) {
$id = request()->param('id');
$popup=Db::name('distribute_leaflet')->alias('a')->join('document b', 'b.id=a.do_cd')->where('a.id',$id)->where('a.de_st',1)->select();
return $popup;
}
}
前台ajax里:function inputPayMethod(id){
$("#payMethod").show();
popupCenter();
$("#popup").show();
$.ajax({
type:'post',
url:'/index.php/admin/Works/popups',
data:'id='+id,
success:function(data){
alert(id);
$('#tbodys').empty();
var opt="";
$(data).each(function(){
opt+="<tr>"
opt+="<td>"+this.do_nm+"</td>"
opt+="<td>"+this.em_cd+"</td>"
opt+="<td>"+this.ac_de_da+"</td>"
opt+="<td>"+this.ad_fa_72+"</td>"
opt+="<td>"+this.un_pr+"</td>"
opt+="<td>"+this.to_mo+"</td>"
opt+="</tr>"
})
$('#tbodys').html(opt);
}
});
}
但是数据插入不到表格里,应该怎么弄
浏览器 直接访问/index.php/admin/Works/popup?id=id参数值看得到什么内容。。你的php必须有输出ajax才能获取到输出内容,只见你的函数return了个变量,自己检查是否有echo输出内容