Returnurl Without Refreshing

hello friends!

          I have 2 CURD 1. user 2. department.

           On that user am having registration form, on that am using department field in a dropdown list. Here am using fancy box for adding departments as shortcut in the registration form. when I click that shortcut fancy box it opens the department/create page as a popup. After I click create button the department created and also registration page got refreshed. I don't want the registration page to refresh. help me out!

It sounds like you need to capture the form submit event in javascript and send the request over AJAX.

this is my action create… sry am not good in ajax… am using ajax like delete process.

public function actionCreate()


		$model=new Department;


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);






				$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('user/create'));

			//	$this->redirect(array('create'));