简体   繁体   English

从python服务器获取数据时出现jQuery 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. 我在前端有一个jQuery Jtable,并且在服务器中使用python flask。

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. 我使用python flask从MYSQL服务器中获取数据,该数据可以在浏览器中以JSON格式查看,但是不幸的是,我无法将JSON数据放入Jtable。

My front end jQuery Jtable is 我的前端jQuery Jtable是

  $('#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. 我也可以在浏览器中查看console.log代码,但在控制台中没有错误。

Can someone please help me with this 有人可以帮我吗

Thanks, 谢谢,

I achieved this by using python jsonify to add my json data to the front end Jtable. 我是通过使用python jsonify将json数据添加到前端Jtable来实现的。

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

)

Thanks 谢谢

The output you are seeing is the standard jTable application error. 您看到的输出是标准jTable应用程序错误。 Your listAction has passed the server response to jTable, so there is no communications error. 您的listAction已将服务器响应传递给jTable,因此没有通信错误。 When the json response does NOT contain Result = 'OK' it displays the application error dialog, and shows the json Message in the dialog. 当json响应不包含Result ='OK'时,将显示应用程序错误对话框,并在对话框中显示json消息。 The very fact that the error dialog appears means jTable is not seeing Result = 'OK' in your server response. 错误对话框出现的事实意味着jTable在服务器响应中没有看到Result ='OK'。 Look for that first, if you are still stuck please post your json response. 首先寻找,如果您仍然卡住,请发布您的json响应。 The dialog is blank because there is no error message or jTable can't see it. 该对话框为空白,因为没有错误message或jTable无法看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在使用python函数获取完整数据时遇到错误? - getting error while fetching full data with my python function? 使用python从bigquery获取数据时linux服务器上的内存错误? - Memory error on linux server while fetching data from bigquery using python? 使用python从API提取JSON数据时遇到keyerror - Getting keyerror while fetching JSON data from API using python 使用Python和Django从文件中获取值时获取错误 - Getting error while fetching value from file using Python and Django 将数据从 SQL 服务器传输到雪花时在 python 上出错 - Getting error on python while transferring data from SQL server to snowflake 使用fastAPI从MongoDb获取数据时出错 - Getting Error while fetching data from MongoDb using fastAPI 在python中从MySql数据库中获取数据时出错 - Error while fetching data from MySql Database in python 为什么在读取 python 中的文件时出现“错误标记数据”? - Why am i getting“Error Tokenizing Data” while reading a file in python? 为什么在尝试通过python插入数据MongoDB时出现错误? - Why I am getting error while trying to insert data MongoDB via python? 将我的 Django 应用程序上传到服务器时出现错误 - I am getting an error while uploading my Django app to server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM