How I can send data from Flask to JavaScript?

Hello I am new and building an application in Flask and Javascript. I have a problem with sending data from Flask do JavaScript. I have code in routes.py @app.route(‘/mapaa’,methods=[‘GET’,’POST’]) …

Can’t return multiple variables from Flask to Javascript AJAX function

I have a JS function that is updating subsequent select boxes based on the previous input. I am populating these with responses from a Flask function that queries a database. The issue is that the …

List of list from flask to JS

My Python code calculate coordonates of devices and put it in a list. So i get a list of list in a python var my_devices_list = [ [“name1”, 11.1, 22.2] , [“name2”, 33.3, 44.4] ] i’…

Materialize css | js – visualization issue in the Carousel Slides

In the home page of my website there’s a Materialize carousel with 3 slides. The page is a python flask template an the Materialize carousel is injected in the page, this is the base.html template …

Passing JSON data from Flask to JavaScript

I am trying to pass a JSON data from flask to JavaScript. The code I tried is from: Passing a JSON object from Flask to JavaScript The steps below are what I did : I first got my data from …

render_template does nothing after receiving ajax content (flask, python, javascript)

I am passing data with ajax to my python function when a condition is met: if (lesson.length === 0) { $.ajax( { type:’POST’, …

How to implement Server-Sent Events in Flask framework?

I’m trying to get a progress bar to work in Flask. I use a Server Sent Events for that. When I run it in local development server, then everything works well and I can see in the browser real time added numbers in /progress window and progress bar works no problems. But if I run it in Linux server (Linode), then browser windows hangs for 10 sec and after that progress bar jumps to 100. I am beginner and do not understand why it works in local machine and why not in the remote server. Please somebody explain. And also

convert wav file received in the request response to blob

I am trying to receive a WAV file as the response to a POST request. I use the send_file in Flask. I try to retrieve the file client-side in the response. I have ultimately converted it to a blob so it can be automatically downloaded. This is the API code for the server: This is the client script for the post request: I get “provided value cannot be converted to a sequence” error from trying to convert res.data to a WAV blob. The file is successfully received, and a valid file is sent back. Creating the blob with [res.data] instead

Flask application redirects to empty “about:srcdoc” page when index (root path) is requested

I am working on a Flask web application. It has two iframes side-by-side and accesses a csv file. The file contains urls that, by using selenium .page_source(), will be loaded into the iframes using srcdoc. The page source is edited using beautiful soup 4 before being turned into a string and being sent to the frontend. The issue I am facing right now is that, when I open the app (either locally or the version hosted on a virtual machine) SOMETIMES I am redirected to an empty page with “about:srcdoc” in the url bar. While it doesnt happen 100%, it

store html checkbox value into list using flask, jinja2

I’m in need of some help. I am using flask and I have had an HTML page with a bunch of checkboxes. They are ordered as option1, option2, and option3 and then under the options, there are a number of boxes to check. I am trying to keep track of what all boxes have been checked for which option and store that information into a list. currently my logic is to use some for loop within the HTML file using Jinja2 and try to set some unique name tag in the form such as name=”{{getboxitem}}” However my logic is only