Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未使用模式引导和codeigniter插入数据_Javascript_Jquery_Codeigniter_Bootstrap Modal_Crud - Fatal编程技术网

Javascript 未使用模式引导和codeigniter插入数据

Javascript 未使用模式引导和codeigniter插入数据,javascript,jquery,codeigniter,bootstrap-modal,crud,Javascript,Jquery,Codeigniter,Bootstrap Modal,Crud,我不熟悉在模态引导中使用javascript和jquery,需要您的建议。 我创建了一个模式来将数据插入数据库。但当我点击“保存”按钮时,什么也没发生。 我希望你能帮我检查一下我的密码是否有问题。我花了一周的时间搜索我的代码是否有任何错误 以下是我的看法: $(document).on("click", ".open-InputNilaiDialog", function () { var myFormId = $(this).data('id'); $(".mo

我不熟悉在模态引导中使用javascript和jquery,需要您的建议。 我创建了一个模式来将数据插入数据库。但当我点击“保存”按钮时,什么也没发生。 我希望你能帮我检查一下我的密码是否有问题。我花了一周的时间搜索我的代码是否有任何错误

以下是我的看法:

$(document).on("click", ".open-InputNilaiDialog", function () {
        var myFormId = $(this).data('id');
        $(".modal-body #nim").val( myFormId );
    });

<div class="modal fade" id="inputNilaiDialog" 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>
                <h4 class="modal-title">Form Nilai</h4>
              </div>
              <div class="modal-body">
                <p>Contoh</p>
            <form class="form-horizontal" method="post" action="<?php echo base_url().'tutor/mtk_np/simpan'?>">
              <div class="box-body">
              <div class="form-group">
                  <div class="col-sm-10">
                    <input type="hidden" class="form-control" id="idtutor" name="idtutor" value="<?php echo $this->session->userdata('username'); ?>"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="nim" class="col-sm-2 control-label">NIM</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="nim" name="nim" readonly />
                  </div>                  
                </div>  
                <div class="form-group">
                  <label for="nilai" class="col-sm-2 control-label">Nilai</label>

                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="nilai" name="nilai" readonly />
                  </div>                  
                </div>  

                <!-- START INPUT HIDDEN-->
                <input type="hidden" class="form-control" id="kd_mtk" name="kd_mtk" value="<?php echo $row->kode_mtk; ?>"/>
                <input type="hidden" class="form-control" id="kelas" name="kelas" value="<?php echo $row->kelas; ?>"/>
                <!-- END INPUT HIDDEN-->
              <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Tutup</button>
                <button type="button" class="btn btn-primary">Simpan</button>
              </div>
              </form>
              </div>
            </div>           
          </div>         
        </div>
我的模型是:

function simpan($data)
{
    $this->db->insert("nilai_tutorial", $data);     
}

可以在config.php和database.php中启用调试选项

在config.php中进行以下更改

$config['log_threshold'] = 1; // You may also set the same to 2 or 3 depending on the level of issue you want to track.
$db['default']['db_debug'] = TRUE;
在database.php中,进行以下更改

$config['log_threshold'] = 1; // You may also set the same to 2 or 3 depending on the level of issue you want to track.
$db['default']['db_debug'] = TRUE;

这将做的是,它将开始记录可能发生的任何类型的错误。这将帮助您在缺少值或出现任何异常时签入。在较新版本的CI中,我遇到过这个问题,如果有任何问题,比如查询中,系统不会抛出错误,而是会抑制错误,使屏幕变空/中断执行,等等。

您可以在config.php和database.php中启用调试选项

在config.php中进行以下更改

$config['log_threshold'] = 1; // You may also set the same to 2 or 3 depending on the level of issue you want to track.
$db['default']['db_debug'] = TRUE;
在database.php中,进行以下更改

$config['log_threshold'] = 1; // You may also set the same to 2 or 3 depending on the level of issue you want to track.
$db['default']['db_debug'] = TRUE;

这将做的是,它将开始记录可能发生的任何类型的错误。这将帮助您在缺少值或出现任何异常时签入。对于较新版本的CI,我遇到过这个问题,如果有任何类似于查询的问题,系统不会抛出错误,而只是抑制错误,使屏幕变空/中断执行等等。

按钮不是提交类型

改变这个

<button type="button" class="btn btn-primary">Simpan</button>
Simpan
对此

<button type="submit" class="btn btn-primary">Simpan</button>
Simpan

按钮不是提交类型

改变这个

<button type="button" class="btn btn-primary">Simpan</button>
Simpan
对此

<button type="submit" class="btn btn-primary">Simpan</button>
Simpan

您的提交按钮
Simpan
看起来很简单,所以您需要更改按钮
type='submit'
来提交表单。@NaimMalek感谢您的回复。。我对我的小错误感到很尴尬您的提交按钮
Simpan
看起来很简单,所以您需要更改按钮
type='submit'
,以提交表单。@NaimMalek感谢您的回复。。我对我的小错误感到很尴尬啊。。。这就是我需要的,我一定要试一下。谢谢你的建议:)啊。。。这就是我需要的,我一定要试一下。谢谢你的建议:)