187
rated 0 times
[
188]
[
1]
/ answers: 1 / hits: 152148
/ 11 Years ago, mon, september 16, 2013, 12:00:00
How do I return response from the controller back to the Jquery Javascript?
Javascript
$('.signinform').submit(function() {
$(this).ajaxSubmit({
type : POST,
url: 'index.php/user/signin', // target element(s) to be updated with server response
cache : false,
success : onSuccessRegistered,
error: onFailRegistered
});
return false;
});
Data is returned null (blank)!
function onSuccessRegistered(data){
alert(data);
};
Controller -
public function signin() {
$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
echo json_encode( $arr );
}
More From » php