2014-09-15 17:40
浏览 37

yii dropdownlist change jquery仅在create中有效

i have form with render partial in yii which make update and create

i write this jquery code to check success only :


it works good to me in create but in update nothing do

i think this error because i get select value from database can any one help me .. iam tired to solve this problem

note: i use this code for main categories and sub categories for my site

my html in update

<div class="controls col-sm-6">                             
<select class="form-control" name="AmakenPlaces[place_main_category]" id="AmakenPlaces_place_main_category">
<option value="">Select main category</option>
<option value="1" selected="selected">cafe and resturants</option>
<option value="2">men and wommen</option>
<option value="3">hoho</option>

my code in javascript

  <script type="text/javascript">
            var id=$(this).val();

            type: "POST",
            url: '<?php echo yii::app()->createAbsoluteUrl("site/subcategory");?>',
            data: "id="+id,
            dataType: 'json',
            cache: false,
                $("#AmakenPlaces_place_sub_category").append('<option selected="selected">--Select Sub category--</option>');


                  $("#AmakenPlaces_place_sub_category").append('<option value=''>''</option>');


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • douwen8424 2014-09-16 15:59

    thanks all for attention my solve to this problem when i delete

    解决 无用
    打赏 举报

相关推荐 更多相似问题