dongpao1918 2014-10-07 04:45
浏览 236

使用Jquery或Javascript在按钮上重新加载div

after click add button in popup bootstrap modal

i want to add record in database and reload the div on same page

$(document).ready(function(){
   $("#Reload").click(function(){
      $("#result").html("result reloaded successfully");
   });
});

enter image description here

after click "add question " record are inserted but how to update background page

i also want to close popup

  • 写回答

1条回答 默认 最新

  • douliaotong4944 2014-10-07 04:54
    关注

    try using "$('#myModal').modal('hide');" to hide model first then append data

    //custom lib function
      $.fn.serializeObject = function()
    {
        var o = {};
        var a = this.serializeArray();
        $.each(a, function() {
            if (o[this.name] !== undefined) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };
    
    //uses
             $(document).ready(function(){
                   $("#Reload").click(function(){
                      $('#myModal').modal('hide');
                      var jsonOfForm = $('formSelector').serializeObject()
                      $("#result").append("result reloaded successfully");
                   });
                });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?