[英]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.