Python To Javascript Json Objects (flask)
I am trying to create a simple Flask app where an array of integers is generated on the server and sent to the client. I want to view the array of integers in the console. Here is
Solution 1:
You're sending your JSON to the template through the variable s_data
.
In the template, you're rendering that variable into a JavaScript variable called data_xyz
. In the next line, you attempt to reference a Jinja variable instead of a JavaScript variable:
varJSONObject = JSON.parse({{data_xyz}});
Change that to:
varJSONObject = JSON.parse(data_xyz);
Post a Comment for "Python To Javascript Json Objects (flask)"