Yii Framework Forum: Call variable php with javascript - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Call variable php with javascript

#1 User is offline   freeyii 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 14-April 11

Posted 27 October 2011 - 09:57 AM

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.
0

#2 User is offline   Muaid 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 112
  • Joined: 25-October 10
  • Location:Saudi Arabia

Posted 14 November 2011 - 11:07 PM

wa alikom al Salam,

this link will be usefull:
http://www.yiiframework.com/wiki/24/

i hope it will solve your problem :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users