dqusbxh44823 2015-01-19 12:11
浏览 51

IE 9中没有填充的级联下拉列表(Codeigniter)

I created a cascading drop-down in Codeigniter, but the second drop-down is not populating in IE 9 and IE 8. Here's the relevant controller:

public function buildDropEquipment($class)
    // This builds the dropdown field for newly added equipment
    {
         //set selected class id from POST
        $class = $this->input->post('class',TRUE);
        error_log("class variable: ".$class." 
", 3, "/Applications/MAMP/logs/php_error.log");


        //run the query for the cities we specified earlier
        $this->load->model('admin/MEquipment');
        $equipmentData['equipmentDrop']=$this->MEquipment->getEquipmentByClass($class);

       $output = null;

        foreach ($equipmentData['equipmentDrop']->result() as $row)
        {
            //here we build a dropdown item line for each query result
            $output .= "<option value='".$row->type."'>".$row->type."</option>";
        }

        echo  $output;
    }

Here's the relevant bit from my view:

<script type="text/javascript">
            $(document).ready(function() { 


                $("#class").change(function(){
                     /*dropdown post */
                    $.ajax({
                    url:"<?php echo base_url(); ?>index.php?/admin/buildDropEquipment",    
                    data: {class: $(this).val()},
                    type: "POST",
                    success: function(data){

                        $("#type").html(data);
                    }                  
                    });  
                });
            });       
        </script>      
    </head>
    <body>

        <!--machine class dropdown-->
        <?php $classDrop = array('none' => 'Select One') + $classDrop; ?>
        <dl>
        <dt><strong><?php echo form_label('Equipment Class', 'class');?></strong></dt>
        <dd>
        <?php echo form_dropdown('class', $classDrop,'','class="required" id="class"');  ?>
        </dd>
        </dl>

        <!--equipment type dropdown-->
        <dl>
        <dt><strong><?php echo form_label('Equipment Type', 'type');?></strong></dt>
        <dd>
        <select name="type" id="type">
        <option value="">Select Equipment Class Above</option>
        </select>
        </dd>
        </dl>

Can anyone tell me why it might not be working correctly in IE 9 and 8?

  • 写回答

2条回答 默认 最新

  • doudou0612 2015-01-19 15:35
    关注

    Because 'class' is a reserved keyword in javascript, you should change it to class_name :

    data: {class_name: $(this).val()},
    
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line