使用codeigniter进行图像验证时,返回ajax响应中的未定义错误

时间:2017-04-03 11:11:43

标签: ajax codeigniter uploadify

下面是我的代码,这里验证工作正常,但是当时没有验证其他部分正在运行,但其返回未定义且显示在警报中,如何删除此未定义

<?php
public function doupload()
{
$upload_config['upload_path'] = './assets/upload/';
$upload_config['allowed_types'] = '*';
$upload_config['max_size'] = '500';
$upload_config['max_width'] = '300';
$upload_config['max_height'] = '300';
$this->upload->initialize($upload_config);
if (!$this->upload->do_upload('Filedata')) {
$upload_info = array(
'error' => strip_tags($this->upload->display_errors())
);
echo json_encode($upload_info);
}
else {
$upload_info = $this->upload->data();
echo json_encode($upload_info);
}
die;
}
?>  

<script>
'onUploadComplete': function(file, data,response) { 
var obj = JSON.parse(data);
alert(obj.error);   
if(obj.error != '')
{
    $('.msg').show();
}else{
    go_next = true;
    data_arr.push(obj.full_path);       
}
},              
</script>

0 个答案:

没有答案