Bootstrap-table is a powerful form-plug-in artifact based on the bootstrap style, official website: http://bootstrap-table.wenzhixin.net.cn/zh-cn/
Here's a small problem: the Bootstrap table table does not load data.
$ ("#button"). Click (function () {
var name=$ ("Input[name= ' name ')"). Val ();
$ (' #table '). Bootstraptable (' Load ', ". /query/findmoonbyname?name= "+name);
}";
I use the JSON data returned by accessing the remote address as data, but it's a mistake.
Workaround:
Converts the returned JSON data to object.
$ ("#button"). Click (function () {
var name=$ ("Input[name= ' name ')"). Val ();
$.ajax ({
type: POST),
URL: ".. /query/findmoonbyname?name= "+name,
success:function (msg) {
///MSG Here is a JSON object, not a JSON string.
$ (' #table '). Bootstraptable (' Load ', msg);
}
);
});
If you set the return response information Content-type to Application/json;charset=utf-8, the returned MSG is the JSON object.
Then you can load it directly.
If you set the return response information Content-type to Text/html;charset=utf-8, the returned MSG is the JSON string.
Then you need to json.stringify (string) to object and then load.
Test:
Bootstrap-table.js version:1.11.1
Bootstrap.js v3.3.0
The above is the small set to introduce the Bootstrap table table has been loaded (load) can not be a quick solution to the data, hope to be helpful to everyone, if you have any questions welcome to my message, small series will promptly reply to everyone, here also thank you for the cloud Habitat Community website support!