Ajax Calling Ajax In Controller

i can access the registration form which appears in a model window via ajax on any page as coded in the menu layout .

i need some thing on click of sumbit buuton of registration form it should get display a thamk you message which is also via ajaxin the same div as that of wherein the registration form appears

registratiincontrooler







  


    if ($model->save()) {echo "thank";	}				

									

									

														




registration view




<?php

/* @var $this UserProfileController */

/* @var $model UserProfile */


$this->breadcrumbs=array(

	'User Profiles'=>array('index'),

	'Create',

);


?>


<div class="span-16">

<!--<div class="user_wizard">

          <ul class="anchor">

            <li><a href="#" class="selected">

              <label class="stepNumber">1</label>

              <span class="stepDesc"> Step 1<br>

              <small class="small">Registration</small> </span> </a></li>

            <li><a href="#" class="disabled" isdone="0" rel="2">

              <label class="stepNumber">2</label>

              <span class="stepDesc"> Step 2<br>

              <small class="small">User Profile</small> </span> </a></li>

			  <!--<li><a href="#" class="disabled" isdone="0" rel="3">

              <label class="stepNumber">3</label>

              <span class="stepDesc"> Step 3<br>

              <small class="small">Login</small> </span> </a></li>-->

       <!--   </ul>

		  <div class="clear"></div>

</div>-->




<?php if(Yii::app()->user->hasFlash('registration')): ?>

<div class="success">

<?php echo Yii::app()->user->getFlash('registration'); ?>

</div>

<?php else: ?>

<div class="form" style="border:1px solid #CCCCCC; background: none repeat scroll 0 0 #F8F8F8;>

<div id="form-content" style="margin:0 0 0 15px">

<?php $form=$this->beginWidget('UActiveForm', array(

	'id'=>'registration-form',

	'enableAjaxValidation'=>true,

	'disableAjaxValidationAttributes'=>array('RegistrationForm_verifyCode'),

	'clientOptions'=>array(

		'validateOnSubmit'=>true,

	),

	'htmlOptions' => array('enctype'=>'multipart/form-data'),

)); ?>


	<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

	

	<?php echo $form->errorSummary(array($model/*,$profile*/)); ?>

	

	<div class="row">

	<div class="rlabel">

	<?php echo $form->labelEx($model,'username', array("style"=>"display:inline")); ?>

	</div>

	<div class="rtextfield">

	<?php echo $form->textField($model,'username', array("style"=>"margin-left:43px")); ?>

	</div>

	<div class="rerror">

	<?php echo $form->error($model,'username', array("style"=>"margin-left:113px")); ?>

	</div>

	</div>

	

	<div class="row">

	<?php echo $form->labelEx($model,'password', array("style"=>"display:inline")); ?>

	<?php echo $form->passwordField($model,'password', array("style"=>"margin-left:43px")); ?>

	<?php echo $form->error($model,'password', array("style"=>"margin-left:113px")); ?>

	<p class="hint">

	<?php echo UserModule::t("Minimal password length 4 symbols."); ?>

	</p>

	</div>

	

	<div class="row">

	<?php echo $form->labelEx($model,'verifyPassword', array("style"=>"display:inline")); ?>

	<?php echo $form->passwordField($model,'verifyPassword'); ?>

	<?php echo $form->error($model,'verifyPassword', array("style"=>"margin-left:113px")); ?>

	</div>

	

	<div class="row">

	<?php echo $form->labelEx($model,'email', array("style"=>"display:inline")); ?>

	<?php echo $form->textField($model,'email', array("style"=>"margin-left:65px")); ?>

	<?php echo $form->error($model,'email', array("style"=>"margin-left:113px")); ?>

	</div>

	

	<div class="row">

	<?php echo $form->labelEx($model,'user_type', array("style"=>"display:inline")); ?>

	<?php echo $form->dropDownList($model,'user_type',$model->getUType()); ?>

	<?php echo $form->error($model,'user_type', array("style"=>"margin-left:113px")); ?>

	</div>

	


	<?php if (UserModule::doCaptcha('registration')): ?>

	<div class="row">

		<?php echo $form->labelEx($model,'verifyCode'); ?>

		

		<?php $this->widget('CCaptcha'); ?>

		<?php echo $form->textField($model,'verifyCode'); ?>

		<?php echo $form->error($model,'verifyCode'); ?>

		

		<p class="hint"><?php echo UserModule::t("Please enter the letters as they are shown in the image above."); ?>

		<br/><?php echo UserModule::t("Letters are not case-sensitive."); ?></p>

	</div>

	<?php endif; ?>

	

	<div class="row submit">

		<?php echo CHtml::ajaxSubmitButton(UserModule::t("Register"),array('/user/register'),array('update'=>'form')); ?>//div for form

	</div>


<?php $this->endWidget(); ?>

</div>

</div><!-- form -->


<?php endif; ?>



i think the problem exists here


<?php echo CHtml::ajaxSubmitButton(UserModule::t("Register"),array('/user/register'),array('update'=>'form')); ?>//div for form

	</div>

example i f i have 3 menu items

home

aboutus

contact

suppose visited home when i click on register a model window with registration form appears and when i clich on submit button model->svae as wel make another call using ajax to update that model window with thank you message

similarly with other items in menu

whats happening is it saves and redirects to /user/registration with thank you but i need same model window and not to be updated with thank message and not redirected thank message

i did try this but it did not save


<?php echo CHtml::ajaxSubmitButton(UserModule::t("Register"),'',array('update'=>'form-content')); ?>

I am calling ajax within ajax .