pythonjtablejquery-jtable

I am getting jQuery Jtable error while fetching data from the python server


I have a jQuery Jtable in the front end and I am using python flask in my server.

I used python flask to fetch data from the MYSQL server which I can view in the JSON format in my browser but, unfortunately I couldn't able to make the JSON data into the Jtable.

My front end jQuery Jtable is

  $('#eventsummary').jtable({
    actions: {
      listAction: function (postData) {
        return $.Deferred(function ($dfd) {
          $.ajax({
            url: '/backend/groupdata',
            type: 'GET',
            data: postData,
            success: function (data) {
              $dfd.resolve(data);
              console.log("loading ");
            },
          });
        });
      }
    },
    fields: {
      irs_type: {
        title: "Date & Time",
        list: true,
      }
    }
  });

  $('#eventsummary').jtable('load');

and this is the error I am getting

I am also able to view my console.log code in the browser, with no error in the console.

Can someone please help me with this

Thanks,


Solution

  • I achieved this by using python jsonify to add my json data to the front end Jtable.

    for result in data:
         json_data.append(dict(zip(row_headers,result)))
    return jsonify(
        {
            'Result': "OK",
            'Records': json_data,
        }
    

    )

    Thanks