Call variable php with javascript


(Programmeur4 You) #1

Salam alykom


<?php

    $jour = je::model()->find('id = :Id', array('Id' => $_POST['journey']));

    $or = $jour->Origin;

    $des = $jour->Destination;

    

   ?>




 <input  name="Or" id="Or" value="<?php echo $jour->Origin; ?>" />

    <input type="hidden" name="des" id="des" value="<?php echo $jour->Destination; ?>" />

that’s my dropdownliste :




  echo CHtml::dropDownList('journey', '', $data, array('id' => 'journey', 'prompt' => yii::t('main', 'Select'),  'class' => 'required'));



i need the code javascript for when i select this dropdownliste will the values which are in input id="Or" and id="des" change also.

i need the code of java, i don’t know how to use it :


<!--<script language="javascript">

    $(document).ready(function(){

        $('#journey').change(function(){


// i don't know how to call this code : $jour = je::model()->find('id = :Id', array('Id' => $_POST['journey']));

   // $or = $jour->Origin;

   // $des = $jour->Destination;




        });


    });

</script>-->

if ther’s other way please help me.


(Muaid M.) #2

wa alikom al Salam,

this link will be usefull:

http://www.yiiframework.com/wiki/24/

i hope it will solve your problem :)