[eluser]Zeeshan Rasool[/eluser]
[quote author="rogierb" date="1256827477"]A controller is executed server side, javascript is executed client side side.
You have to put the javascript in HTML, either a view file (The Better Way) or echo HTML in your controller.
Another solution would be to pass a variable wth the error message to your view file
Code:
$error = "Related records has been added into Admin group.";
and in your view file
Code:
error = '<?php echo $error?>'
if(error !='') alert(error)
Edit: To late....[/quote]
Yes, rogierb defined it well. You can pass whole html or pass javascript thru controller to get this way.