内联形式工作精细铬,但不在mozilla

时间:2015-04-06 07:37:21

标签: php ajax codeigniter modal-dialog

这是我的代码,它在chrome上工作正常,但没有在mozila上工作。我试过但我不明白为什么它不起作用。谢谢你的帮助。

    <div class="page-content">
    <div class="page-header">
    <h1>Add new report</h1>
    </div><!-- /.page-header -->

    <?php
     if ( isset($msg) && $msg != null ){
     if ( isset( $msg_type ) && $msg_type != null ){
     $alert_type = 'alert-'.$msg_type;
     }else{
      $alert_type = 'alert-info';
     }
    ?>
    <div class="alert <?php echo $alert_type;?>">
     <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    <?php echo $msg;?>
    </div>
    <?php
    }
    ?>
    <div class="row">
     <div class="col-xs-10 col-sm-10 col-md-10">
     <!-- PAGE CONTENT BEGINS -->
      <div class="table-responsive">
       <form name="prof" action="<?php echo base_url();?>addrep" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
       <div class="form-group">
        <label class="col-xs-3 col-sm-3 col-md-3 control-label">Select network:</label>
       <div class="col-xs-3 col-sm-3 col-md-3">
    <select name="nid" class="form-control input_sm" id="nid">
            <option value="">Select network</option>
            <?php foreach( $networks as $network ): ?>
              <option value="<?php echo $network->net_id;?>"><?php echo $network->net_name;?></option>
          <?php error_log($network->net_id);?>
            <?php endforeach; ?>
          </select>
      <button class="btn btn-primary btn-xs new_bm" data-toggle="modal" data-target=".add_net" id="">Add Network</button>
       </div>
      </div>
      <div class="form-group">
       <label class="col-xs-3 col-sm-3 col-md-3 control-label">Select network element:</label>
       <div class="col-xs-5 col-sm-5 col-md-5">
        <select name="ne" class="form-control input_sm" id="ne">
            <option value="">Select network element</option>
            <?php foreach( $ners as $ne ): ?>
              <option value="<?php echo $ne->ne_name;?>"><?php echo $ne->ne_name;?></option>
          <?php error_log($ne->ne_name);?>
            <?php endforeach; ?>
          </select>
       </div>
      </div>
      <div class="form-group">
       <label class="col-xs-3 col-sm-3 col-md-3 control-label">Select report type:</label>
       <div class="col-xs-5 col-sm-5 col-md-5">
    <select name="rt" class="form-control input_sm" id="rt">
           <option value="">Select report type</option>
         </select>
       </div>
      </div>
      <div class="form-group">
       <label class="col-xs-3 col-sm-3 col-md-3 control-label">Enter report name:</label>
       <div class="col-xs-5 col-md-5 col-sm-5">
         <input type="text" name="rep_name" id="rep_name" placeholder="Enter report name" />
       </div>
      </div>
      <div class="col-sm-offset-4 col-md-offset-4 col-xs-offset-4">
       <button type="submit" class="btn btn-primary" name="submit-buttons" id="submit-buttons" value="add">Add</button>
       <button type="submit" class="btn btn-primary" name="submit-buttons" id="submit-buttons" value="cancel">Cancel</button>
      </div>
     </form>
    </div>
    <div class="modal fade add_net" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
     <div class="modal-content">
      <div class="modal-header">
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="modalLabel">Add Network</h4>
       </div>
       <div class="modal-body">
        <form role="form" class="form-inline" action="addnet" method="post">
         <div class="form-group">
          <h4>Network name</h4>   
          <input type="text" value="" name="net" id="net" class="form-control" placeholder="New name" />
         </div>
     <div>
          <input type="submit" value="Add" class="btn btn-primary btn-xs" />
     </div>
        </form>
       </div>
      </div><!-- /.modal-content -->
     </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
  </div>
 </div>
</div>
<script>
  $( "#ne" ).change(function(){
    var options = [];
    options.push( '<option value="', '', '">', 'Select report type', '</option>' );
    $( "#rt > option" ).remove();
    $.ajax({
      type : 'POST',
      url : 'grtbne',
      data: 'ne='+$(this).val(),
      dataType: 'json',
      success : function(result){
        $.each ( result, function (key , value){
          options.push( '<option value="', value.report_type, '">', value.report_type, '</option>' );
        });
        $( "#rt" ).html( options.join( '' ) );
      },
    });
  });
</script>

这里,ajax用于动态加载所选项目。

1 个答案:

答案 0 :(得分:0)

$。每个问题都不适用于firefox。请尝试将其更改为for循环可能或任何其他替代方案应该有效。