Reputation: 1449
How can i call a JS function when the ajax request is completed
I'm Using Js helper and RequestHandler Component
This is my view file
<?php echo $this->Js->submit('Create User', array(
'before'=>$this->Js->get('#loading')->effect('fadeIn'),
'success'=>$this->Js->get('#loading')->effect('fadeOut'),
'update'=>'#success',
));
?>
i'm getting a loading message and success message... I want to call a JS function when the ajax request is done/completed, so that i can close the User registration DIV
Upvotes: 2
Views: 2563
Reputation: 1449
i solved it...there is a method in Js Helper called complete and we can call JS function
<?php echo $this->Js->submit('Create User', array(
'before'=>$this->Js->get('#loading')->effect('fadeIn'),
'success'=>$this->Js->get('#loading')->effect('fadeOut'),
'update'=>'#success',
'complete' => 'self.setInterval("test()",2000);'
));
test() will be called after ajax request is completed.
Upvotes: 3