i have one div that i m hiding and displaying update form in that place, after submitting that i m able to display the messege but not able to update the div values
this is my js function
[color="#008000"][b]function updatecontactdetails(_url)
{
// If its a string then set the global variable, if its an object then don't set
if (typeof(_url)=='string')
_updatecontactdetails_url=_url;
jQuery.ajax({
url: _updatecontactdetails_url,
'data':$(this).serialize(),
'type':'post',
'dataType':'json',
'success':function(data)
{
if (data.status == 'failure')
{
$(".contact_details").hide();
$('#dialogcontactdetails div.edit_contact_details').html(data.div);
// Here is the trick: on submit-> once again this function!
$('#dialogcontactdetails div.edit_contact_details form').submit(updatecontactdetails); // updatePaymentComment
}
else
{
$('#dialogcontactdetails div.edit_contact_details').html(data.div);
//commentContainer.slideUp('slow', function() {$(this).update();});
$(".contact_details").show(data);
//$("#contact_details").load('loan_details_view.php');
//$("#edit_contact_details").replaceWith($('#contact_details', $(data)));
//$(".contact_details").show();
setTimeout("$('#dialogcontactdetails').dialog('close') ",2000);
//$("#contact_details").load("feeds.html");
//$.fn.yiiGridView.update('event-client-grid');
}
} ,
'cache':false});
return false;
}[/b][/color]
and this my controller
[color="#008000"][b]if(isset($_POST[‘ContactDetails’]))
{
$model->attributes=$_POST['ContactDetails'];
if($model->save())
if (Yii::app()->request->isAjaxRequest)
{
echo CJSON::encode(array(
'status'=>'success',
'div'=>"Classroom successfully added"
));
exit;
}
$this->redirect(array('view','id'=>$model->contact_details_id));
}
if (Yii::app()->request->isAjaxRequest)
{
echo CJSON::encode(array(
'status'=>'failure',
'div'=>$this->renderPartial('_form', array('model'=>$model), true)));
exit;
}
else
$this->render('create',array(
'model'=>$model,
));
[/b][/color]
how should i update the due