查詢事件
function btnQuery()
{
$("#btnQuery").click(function () {
var vUrl = "@Url.Content("~/SysManage/User/getUserInfo")";
var vUserNo = $("#txtUserNo").val();
var vUserName = $("#txtUserName").val();
var vdata;
$.ajax({
url: vUrl,
type: "post",
dataType: 'json',
async: false,
data: { strUserNo: vUserNo, strUserName: vUserName },
success: function (result, status, xhr) {
$table.bootstrapTable('load', result);
},
beforeSend: function (xhr) {
},
complete: function (xhr, status) {
},
error: function (xhr, status, error) {
}
});
});
}
console.log(result)的結果:
[
{
"ID": 1,
"USERNO": "245",
"USERNAME": "123",
"USERPWD": null,
"USERTEL": null,
"USERMAIL": null,
"CREATE_USER": null,
"CREATE_DATE": null,
"UPDATE_USER": null,
"UPDATE_DATE": null
}
]
如果設定一個變量var data1,console.log(result)出來的結果賦給這個變量,如下:
var data1=[
{
"ID": 1,
"USERNO": "245",
"USERNAME": "123",
"USERPWD": null,
"USERTEL": null,
"USERMAIL": null,
"CREATE_USER": null,
"CREATE_DATE": null,
"UPDATE_USER": null,
"UPDATE_DATE": null
}
]
bootstrap-table又是可以顯示的。