codeigniter 3 json response object code example
Example: codeigniter 3 return json response
$('.signinform').submit(function() {
$(this).ajaxSubmit({
type : "POST",
dataType:'json',
url: 'index.php/user/signin',
cache : false,
success : function(response){ console.log(response); alert(response)},
error: onFailRegistered
});
return false;
});
public function signin() {
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
header('Content-Type: application/json');
echo json_encode( $arr );
}