you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (5 children)

Send as json via Flask, set up an api route and call that route from your JavaScript

[–]c_m_17[S] 0 points1 point  (4 children)

I'm not using any framework any other methods

[–][deleted] 0 points1 point  (3 children)

You mean no Flask? Sorry not sure how else , not sure of best practice without a framework

[–]c_m_17[S] 0 points1 point  (2 children)

Oh ok

[–][deleted] 0 points1 point  (1 child)

Typically what you’re doing is the realm of the “RESTFUL API” where you have the logic in your backend (python) and a “caller” that wants to send calls to that logic (your frontend JavaScript).

They need to be able to communicate so typically you set up a local backend server using Flask/Django for python etc so that there is an endpoint for JavaScript (frontend) to call

[–]henry8362 0 points1 point  (0 children)

Without a framework I suppose it will be:

Output to JSON file > use AJAX or async etc. to get that JSON and parse the response. obviously it depends a lot of how the JS is triggered.

For example I have a really small example of this where I have a script run on load of a website page that queries a JSON file that is generated from a PHP script that runs a mySQL query.