[Solved] How To Reuse Javascript Data In Php View (Edit : All Data In The Post But Not Displaying) (Solved)

Hi everybody.

I have a view where I have a script :

If I alert() nbNavettes i have the right number.

but now, I want to reuse this var in my php.

So I have to go back to the server. (no?)

then, I try to send it with a render partial :


<?php 

	echo( $this->renderPartial(

               '_prixNavette',	          

               array(						

                        'form'=>$form,

		        'numJour'=>$i,

			'q'=>$q,

			'nbNavettes'=>'js:nbNavettes'),

                         TRUE));

or with an ajax function :




<script type="text/javascript">

$.ajax({

	url: "<?php echo CController::createUrl('admin/UpdateAjaxFormPrixQualite');?>",

	data: (						

             'form'=>$form,

	     'numJour'=>$i,

	     'q'=>$q,

		'nbNavettes'=>'js:nbNavettes')

});

</script>



but doesnt work

have any other idea? (I got the string ‘js:nbNavette’ and not the value… ^^

is that possible to have this format of code to send it ?


 // this work on a dropdown list ajax option.

'ajax' => array(

		'type' => 'POST',

		'url' => @Yii::app()->createUrl('admin/UpdateAjaxFormNbJours'),

		'data' => array('form'=>serialize($form),'nbJours'=>'js:this.value', 'tab'=>$tab),

		'update' => '#dateEvent'),

thanks :)

solution :

so what I have :

My script :




<script type="text/javascript">

	$.ajax({type: "POST",

	url: "<?php echo CController::createUrl('admin/UpdateAjaxFormPrixQualite');?>",

	data:  {nbNavettes :nbNavettes<?php echo($i);?>},

	success:function(data){

	     if(data){

		$('#prixNav<?php echo($q);?><?php echo($i);?>').html(data);

	     }else{<?php echo("error");?> }}				        

});

</script>



My action in the controller :




    public function actionUpdateAjaxFormPrixQualite()

    {

  		$this->renderPartial(

    			'_prixNavette',

    			array(

    					'nbNavettes'=>$_POST['nbNavettes']),

  				false,

    			TRUE);


    }



and My _prixNavette view :




echo('hi ! : nb Navette '.$nbNavettes);



thanks to all :)