How can i import json in datatable from console..in python flask
How can i import json in datatable from console..in python flask
karan_1994
Posts: 6Questions: 1Answers: 0
Please help me out...as mostly it depends on jquery but any hints would really work.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sorry, I don't understand your question. Can you provide a bit more detail of what you want to do? I'm a bit confused about the "console" part of the question.
Kevin
hi .. I have a json returned and i am printing it on a console.
using javascript..how do I print it in data tables.
You can add it to Datatables using the
rows.add()
API. Then usedraw()
to redraw the updated Datatable.Kevin
code for my html and javascript.
code for javascript..
this is the file where i need to use ajax in order to access the url and display data in tables..
So how do i call the url
$(document).ready(function() {
$("#submit_btn").click(function(e)
{
e.preventDefault();
$.post( "/output", $( "#main_form" ).serialize(),function(dataSet){
console.log(dataSet.manufacturerPartNumberSearchReturn);
//$("#info_table").html(JSON.stringify(data));
//alert(dataSet.manufacturerPartNumberSearchReturn.products[0].brandName);
var dataObject = dataSet.manufacturerPartNumberSearchReturn.products; // variable in which api data is.
});
The
ajax
is used within the Datatables config. There are some examples in the doc page. Also here is an example:https://datatables.net/examples/data_sources/ajax.html
More examples here:
https://datatables.net/examples/ajax/index.html
Looks like you want to use the POST option as shown in the docs.
The Data doc page explains the supported data formats.
Kevin
Thank you kevin.. You really rock..
Sorry for late reply.
I am trying on it