如何實現bootstrap jquery dataTable異步ajax刷新表格數據
導語:下面小編給大家提供瞭如何實現bootstrap jquery dataTable 異步ajax刷新表格數據,大家可以參考閱讀,更多詳情請關注應屆畢業生考試網。
異步請求
var postData = {
"env_name" : new_env_name,
"env_url": new_env_url,
"env_desc" : new_env_desc
};
$({
type: 'POST',
url : '/test_env_add/',
data : postData,
dataType : 'json',
success : function(data){
$('#table_test_env')Table()earTable(); //清空表格
$('#table_test_env')Table()dData(packagingdatatabledata(data),true); //刷下表格
$("#modal-container-648308")l("hide");
},
error:function(data){
alert("新增失敗");
}
})
數據處理函數packagingdatatabledata,異步請求返回的_env_all必須是一個json格式數據
function packagingdatatabledata(data){
var editHtml='<button href="#modal-container-648308" rel="external nofollow" data-toggle="modal" class="btn btn-xs btn-info" onclick="test_env_modify(this)"> <i class="icon-edit bigger-120"></i> </button> <button href="#modal-container-648300" rel="external nofollow" data-toggle="modal" class="btn btn-xs btn-danger" onclick="test_env_delete(this)"> <i class="icon-trash bigger-120"></i> </button>';
var a=[]; //全部行數據的
var banddata = _env_all;
for(var key in banddata){
var tempObj=[]; //一行數據的list
(banddata[key]);
(banddata[key]);
(banddata[key]);
(banddata[key]);
(editHtml);
(tempObj);
}
return a;
}
相關文章
-
whats your plan for dragon boat festival英語作文
As a chinese, I was really ashamed of having a little knowledge of dragon boat festival. Perhaps I was bo in northe city, though my city is nearby sea, it has been built a U port which I can only see -
英語閱讀:Dollar Hit by Trump Tax Plan Doubts
The dollar was trading at more than one week lows against a basket of the other major currencies on Wednesday amid uncertainty over President Donald Trump’s tax plan, while the euro was higher a -
jQuery中的read和JavaScript中的onload函數的區別在哪
在JavaScript中,onload函數是最經常使用的,幾乎涉及到JavaScript的童鞋都少不了要接觸它。這個函數的作用就是等待網頁完全裝載完了以後再去執行代碼塊內的語句,因爲按照文檔流的執行順序,通常用於頭部加載JavaScript的` -
怎樣理解jquery中ajax的dataType屬性選項值
jquery中ajax的dataType屬性用於指定服務器返回的數據類型,如果不指定,jQuery 將自動根據HTTP包MIME信息來智能判斷,如果datatype選項不填寫的話,會將返回的數據當成字符串處理。 一、ajax語法複製代碼 代碼如下:([set -
Happy Dragon Boat Festival英語作文
This moing,as we all know,this is a special day___our Chinese national we go out of home, and began to preper for somthing for the day.There were so many people with smiles on their faces in the had -
How Do My Parents Feel About My Education英語作文
I enter college with wishes to gain more in my study of knowledge and methods to be a man. But my opinion is more or less different from my parents’. They consider that a college degree will do me mu -
oracle中truncatetable後的數據如何恢復
Oracle認證是由Oracle公司,爲能夠滿足對Oracle核心人士需求,Oracle公司頒佈並實施的一項權威品的服務與支持。下面小編爲大家整理了關於oracle中truncatetable後的數據如何恢復的文章,一起來看看吧:1、首先下載odu數據恢 -
國中英語作文To Bea Computer Expert Is My Ideal
上國小的時候,家裏買了電腦作文 ,我對它迷戀極了。從此我有了一個理想,即當一名電腦專家。我要用自己的智慧和勤奮發明世界上最先進的電腦。我相信只要我努力學習,理想就一定會變成現實。To Be a Computer Expert Is My I -
Javascript實例教程如何使用HoTMetal
HoTMetal中使用javascript3.什麼樣的資源適合於腳本編寫當利用HotMetal PRO 6.0編寫宏的時候,你可以使用以下幾種資源:預定義事件HoTMetaL PRO 6.0定義了幾個事件以及特殊的用戶定義的宏來處理它們。這些宏應該根基HoTM -
Jolie drops battle over perfume named Shilohy英語作文
angelina jolie has dropped her legal battle with a perfume-maker who had named her fragrance shiloh - the same as jolies youngest daughter.jolie had filed a note with the u.s. patent and trademark off