I am encountering an issue with my Jquery function in the controller. It seems to be unable to read the Json_encoded object, even though I am using codeigniter. Any ideas why?
$(this).ajaxSubmit({
type : "POST",
url: '../index.php/user/signin', // target element(s) to be updated with server response
cache : false,
dataType:'json',
success : function(data){
data = $.trim(data);
alert(data);
var obj = jQuery.parseJSON(data);
alert(obj.Condition);
},
error: function(){
}
Controller
$arr = array('Condition' => $condition, 'Message' => $msg);
// header('Content-Type: application/json');
echo json_encode($arr);