my controlloer action is as
public function actionUserwallpost(){ $model = new Post(); if($_POST['postid']){ if(strlen($_POST['reply'])>1) $_POST['Post']['description']=$_POST['reply']; $_POST['Post']['user_id'] = Yii::app()->user->id; $_POST['Post']['receiver_id'] = $_POST['author_id']; $_POST['Post']['is_loaded'] = $_POST['postid']; } if(isset($_POST['Post']) && !empty($_POST['Post'])) {$model->attributes=$_POST['Post'];$model->receiver_id = Yii::app()->user->id; if($model->validate()){ $model->save(false); $data = '<li> <figure class="wall-pic">'; $user = User::model()->findByPk(Yii::app()->user->id); $data .=FileManager::File($user, $user->user->images->image,1); $data .= '</figure> <div class="wall-comment-wrap"> <div class="wall-title"> <span class="name"> @'; $data .= $user->username; $data .='</span> <span class="comment-time">'; $data .= Main::Fdate($model->created); $data .= '</span> </div> <div class="your-text"> <p>'; $this->beginWidget("ext.jtruncate.JTruncate", array( "id"=>get_class($model)."_".$model->id, "length"=> 150, "minTrail"=> 0, )); $data .= $model->description; $this->endWidget(); $data .='</p> </div> </div> <div class="expand-t-r-f"> <div class="managewall"> <span> <img src="../images/expend-ico.png" alt="expand"> </span> <span> <a href="#">Expand </a></span> <span> <img src="../images/tweets-ico.png" alt="tweet"> </span><span>' .CHtml::ajaxLink('Reply',Yii::app()->createUrl('post/reply',array('id'=>$model->id)),array('success'=>'js: function(data) { if(data){ function checkobject(obj) { if (document.getElementById(obj)) { return true; } else { return false; } } if (checkobject("post_reply_form_'.$model->id.'")) { //alert("This object exists"); //document.getElementById("post_reply_form_'.$model->id.'").value = "It Existed"; }else { $(".reply_'.$model->id.'").append(data); } }}'),array('id'=>$model->id)).' </span> <span> <img src="../images/retweets-ico.png" alt="retweet"> </span><span> <a href="#"> Retweet</a> </span> <span> <img src="../images/favourite-ico.png" alt="favorite"> </span> <span><a href="#"> Favourite</a> </span> <div class="reply_'.$model->id.'"> </div> </div> </div> </li> '; echo $data; Yii::app()->end(); }else Yii::app()->user->setFlash('error','Please Try again.'); echo 'error'; exit; } }
When post success full the response is appended to the div in the wall. Up to this its ok.
I have a reply link in above resonse.
CHtml::ajaxLink('Reply',Yii::app()->createUrl('post/reply',array('id'=>$model->id)),array('success'=>'js: function(data) { if(data){ function checkobject(obj) { if (document.getElementById(obj)) { return true; } else { return false; } } if (checkobject("post_reply_form_'.$model->id.'")) { //alert("This object exists"); //document.getElementById("post_reply_form_'.$model->id.'").value = "It Existed"; }else { $(".reply_'.$model->id.'").append(data); } }}'),array('id'=>$model->id))
So when i click on the link in generated by the response. Thank it can't be trigered or its not working. So how i can i solve this problem. Thank you waiting any kind of help regarding this issue.