Bootstrap-table is a powerful form plug-in artifact based on Bootstrap style, official website: http://bootstrap-table.wenzhixin.net.cn/zh-cn/
Here is a small problem: theBootstrap table table has been unable to load data .
$ ("#button"). Click (function() { var name=$ ("input[name= ' name ']"). Val (); $ (' #table '). Bootstraptable (' Load ', ".. /query/findmoonbyname?name= "+name); });
I use the JSON data returned from the remote address as data, it's all right, but it's a mistake.
Workaround:
converts the JSON data that is put back to object .
$ ("#button"). Click (function() { var name=$ ("input[name= ' name ']"). Val (); $.ajax ({ "POST", URL:".. /query/findmoonbyname?name= "+name,
function (msg) {
The MSG here is a JSON object, not a JSON string.
$ (' #table '). Bootstraptable (' Load ')
});
If you set the returned 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 returned response information Content-type to Text/html;charset=utf-8, the MSG returned is the JSON string.
Then you need to json.stringify (string) into the object and then load it.
Test:
Bootstrap-table.js version:1.11.1
Bootstrap.js v3.3.0
Note: The solution to this article is only for my problem solved, please test your own.
Bootstrap Table table has been unable to load data