The Bootstrap Table cannot load data quickly.

Source: Internet
Author: User

The Bootstrap Table cannot load data quickly.

Bootstrap-table is a powerful table plug-in based on Bootstrap style, Official Website: http://bootstrap-table.wenzhixin.net.cn/zh-cn/

The following is a small problem: the Bootstrap Table cannot 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 the data. It's okay, but it's an error.

  Solution:

Convert the stored json data into an object.

$ ("# Button "). click (function () {var name = $ ("input [name = 'name']"). val (); $. ajax ({type: "POST", url :".. /Query/FindMoonByName? Name = "+ name, success: function (msg) {// msg is a json object, not a json string. $ ('# Table'). bootstrapTable ('load', msg );}});});

If you set the returned Response Message 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 Message Content-Type to text/html; charset = UTF-8, the returned msg is a json string.

Then you need to convert JSON. stringify (string) into an object and then load it.

Test:

Bootstrap-table.js version: 1.11.1
Bootstrap. js v3.3.0

The above is a quick solution that the Bootstrap Table has been loaded (load) and cannot load data. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner, and I would like to thank you for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.