jQuery追加+ PHP

I'm using Yii framework and I want call a PHP function and return a value.

This value has to be appended to a div. I try a lot of things but nothing works. This is more far that I get:

echo CHtml::ajaxSubmitButton('add one more',
    CController::createUrl('cadTabelapreco/UpdateFilho'),
array('type'=>'POST',
      'data'=>array('item'=>'CadTabelaprecoi',
                    'i'=>$i,            
      'complete' => 'function(){
            $("#data").append($(this).html()); 
      }',         
));

I also try this:

array('type'=>'POST',
      'data'=>array('item'=>'CadTabelaprecoi',
                    'i'=>$i,
                    'form'=>$form),            
      'complete' => 'function(ret){
            $("#data").append().val(ret); 
      }',         
));

The thing is, if I debug it with Firebug, I see the response and its right, but I can't append the value to the div. How to do that?

echo CHtml::ajaxSubmitButton('add one more',
    CController::createUrl('cadTabelapreco/UpdateFilho'),
array('type'=>'POST',
      'data'=>array('item'=>'CadTabelaprecoi',
                    'i'=>$i,            
      'success' => 'function(data){//pass data to success function
      $("#data").empty();//clear div cause if without you'll stack data in your div      
      $("#data").append(data);//append your url return 
      }',         
));

In your Controller :

public function actionUpdateFilho{
/**
* Do what you need here
*/
echo $result;//form variable string with result wich you want to output(in HTml format wich you need) 
}

It's working great for me. Hope this was helpfull.

The problem was the javascript. jQuery's val() returns the value of a input element. If you want to append whatever html or text was returned from the server, the last line should read:

$("#data").append(ret);