how to load the local JSON variable using jquery datatable

前端 未结 5 1179
醉话见心
醉话见心 2020-12-28 08:09

I have a local JSON dataset. I want to use jquery datatable plugin to display it. Is there any setting or configuration inside datatable plugin to display data? All I can fi

5条回答
  •  误落风尘
    2020-12-28 08:52

    You can get your json local file doing a normal ajax call, with some caveats (see http://en.wikipedia.org/wiki/Same_origin_policy, or jQuery's .getJSON using local files stopped working on Firefox 3.6.13, fwiw)

    But it should definitely be possible to do:

    $.getJSON('page.json', function(data) {
        /* do something with each item in data */
    });
    

提交回复
热议问题