如何在弹出窗口中打开pdf文件?

时间:2018-10-09 12:38:59

标签: php html codeigniter

我想使用onclick事件打开一个pdf文件(从数据库中)以传递两个参数。

这是我的html

<td class="text-center"> 
    <button  data-toggle="modal" data-target="#myModal1" onclick="edit_book1(<?php echo $row['markid'].'/'.$row['appno'];?>)"><i class="glyphicon glyphicon-eye-open"></i></button>
</td>

AJAX

          function edit_book1(markid)
      {
        save_method = 'update';
        $('#form2')[0].reset(); // reset form on modals

        //Ajax Load data from ajax
        $.ajax({
          url : "<?php echo site_url('/users/ajax_edit1')?>/" + markid,
          type: "POST",
          dataType: "JSON",
          success: function(data)
          {
          console.log(data.file_name);
          alert(data);


              $('[name="title"]').val(data);   

              $('#modal_form2').modal('show'); // show bootstrap modal when complete loaded
              $('.modal-title').text('Upload Images'); // Set title to Bootstrap modal title

          },
          error: function (jqXHR, textStatus, errorThrown)
          {
              alert('Error get data from ajax');
          }
      });
      }

模式窗口

          <div class="modal fade" id="modal_form2" role="dialog" >
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h3 class="modal-title">Book Form</h3>
          </div>
          <div class="modal-body form">
           <!-- <form action="#" id="form1" class="form-horizontal">  -->
              <?php $this->load->helper("form"); ?>
            <form action="<?php echo base_url();?>upload/do_upload" id="form2" method="post" class="form-horizontal" enctype="multipart/form-data">

              <input type="text" value="<?php echo $appno; ?>" name="appno" readonly/>
              <div class="form-body">
                <div class="form-group">
                  <label class="control-label col-md-3"></label>
                  <div class="col-md-3">
                    <input name="title" readonly="true" placeholder="Markid" class="form-control"  >
                  </div>


                <div class="modal-footer">
                  <input type="submit" class="btn btn-primary" id="submit" value="Upload" />

             </div>

            </form>
              </div>

            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

模态窗口无法打开。我犯了什么错误?有人请帮助我解决问题。警报显示正确,但不显示窗口

0 个答案:

没有答案