2014-10-07 68 views
0

,單擊Add按鈕後,自舉模式在彈出使用jQuery或Javascript

我想在數據庫中同一頁

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

enter image description here

上添加記錄並重新加載DIV點擊一個按鈕重裝一個div

點擊「添加問題」後記錄被插入,但如何更新背景頁面

我也想關閉彈出

+0

不能在這裏完全理解你的問題。如果你想添加一些東西到數據庫中,那你試過的代碼是什麼? – 2014-10-07 04:47:10

+0

是什麼問題? – divakar 2014-10-07 04:47:20

+1

您應該使用表單動作或ajax將數據發送到php頁面並在存儲數據後將其存儲在數據庫中更新div。 – divakar 2014-10-07 04:48:22

回答

0

嘗試使用"$('#myModal').modal('hide');"先隱藏模型,然後將數據追加

//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"); 
       }); 
      }); 
+0

thanx @Pankaj Sharma – Coderbaba 2014-10-07 05:06:17

+0

歡迎朋友:) – 2014-10-07 06:02:02