• Resolved 8oris

    (@8oris)


    Hello,

    I tried to load a json file with ajax but it doesn’t seem to work.

    Here’s the code:

    [wp-datatable id="table"]
    paging: false,
    responsible: true,
    search: true,
    stateSave: true,
    ajax: {
    url: "<em>URL</em>/webradio_test.json"
    },
    dataType: 'json',
    cache: false,
    type: 'GET',
    columns: [{ "data": "URL" },{ "data": "public" }]
    [/wp-datatable]

    Here’s the json file:

    [
      {
        "URL": "4urock.com",
        "public": "tous publics"
      },
      {
        "URL": "77fm.net",
        "public": "tous publics"
      }
    ]

    Any idea about where i did some mistakes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author samsk

    (@samsk)

    Try to debug it with browser console, there you should see possible error.

    Thread Starter 8oris

    (@8oris)

    Ok, problem solved thanks to my JS expert colleague.

    So here’s the content of the wordpress page:

    [wp-datatable id="webradio-table"]
    paging: false,
    responsible: true,
    search: true,
    stateSave: true,
    ajax:  { url :"/dlweb-doc/webradio_test.json", type : "GET"},
    columns: [
    { "data": "URL", "title" : "URL"},
    { "data": "public", "title" : "public" }
    ]
    [/wp-datatable]
    
    <table id="webradio-table"/>

    Here’s the data:

    {
      "data" :
      [
        {
          "URL": "4urock.com",
          "public": "tous publics"
        }
    ,
        {
          "URL": "77fm.net",
          "public": "tous publics"
        },
        {
          "URL": "78fm.net",
          "public": "tou publics"
        }
      ]
    }
    • This reply was modified 7 years, 2 months ago by 8oris.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using Json data for input’ is closed to new replies.