用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1604|回复: 1
收起左侧

CI学习AJAX提交表单

[复制链接]
发表于 2017-10-23 14:56:29 | 显示全部楼层 |阅读模式

ajax
php 代码
$data=array(
$data['success']=1,
);
$this->output->set_output(json_encode($data));
$this->output->_display();
eixt;
html代码如下
function saveform(){
$ajax({ type:'post',
url:'<?php echo $now_url;?>',//这里是地址
datatype:'json',
async:false,
data('#form1').serialize(),
success:function(data){
if (data==1){
alert('success'); window.location.href="跳转url";
}else{ alert('err');
}
}
}); }


 楼主| 发表于 2017-10-23 14:57:23 | 显示全部楼层
$输出变表情了

本版积分规则