Below is my code here validation working fine but while no validate at that time else part is working but its return undefined and showing in alert, how remove this undefined
<?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>