如何将包含文件导入到ajax模式引导程序中

时间:2017-11-25 23:49:15

标签: javascript ajax twitter-bootstrap

如何在modal bootsrap体类中获取值。 我需要表单的include是从ajax获取值。

这样的价值:

<?php include ("form/form_sk_dpa");

该值来自ajax。

这是我的代码:

function new_cetak_sk(sk_id_jenis)
{
    $('#form')[0].reset();
    $('.form-group').removeClass('has-error');
    $('.help-block').empty();

    $.ajax({
        url : "<?php echo site_url('cetak_sk/ajax_new/')?>/" + sk_id_jenis,
        type: "GET",
        dataType: "JSON",
        success: function(data)
        {           
            $('[name="sk_id_jenis"]').val(data.sk_id_jenis);
            $('[name="jenis_surat_keputusan"]').val(data.jenis_surat_keputusan);
                var jenis_sk = data.jenis_surat_keputusan;

                var jenis_sk_include = "< &#63; php include ('form/form_sk_"+data.sk_id_jenis+".php') &#63; >";

            $('#modal_new').modal('show');
                $('.modal-title').text(jenis_sk);
                $('.modal-body-1').text(jenis_sk_include);
            },
            error: function (jqXHR, textStatus, errorThrown)
            {
            alert('Error get data from ajax');
            }
            });
    }

那个值,我想在引导程序中得到这个。 这是我的bootstrap视图模式:

<!-- Bootstrap modal -->
<div class="modal fade" id="modal_new" 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"></h3>
        </div>
        <div class="modal-body-1 form">

        <div class="modal-footer">

        Isi dengan Benar!
        </div>
        </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>

这是我将选择的文件格式: 形式/ form_sk_dpa.php

<form action="#" id="form" class="form-horizontal">
<div class="panel panel-primary">
    <div class="panel-heading">Nomor Surat Keputusan - Dosen Pembimbing Akademik (DPA)</div>
    <div class="panel-body">

......

<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-ok-sign"></span> Simpan</button>
</form>     

更多选项文件表单将包括ajax更改时。

0 个答案:

没有答案