Flask & the Fetch API (AJAX?) - Python on the web - Learning Flask Series Pt. 10

Flask & the Fetch API (AJAX?) - Python on the web - Learning Flask Series Pt. 10

Julian Nash

5 лет назад

58,252 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Mateusz Szubartowski
Mateusz Szubartowski - 20.03.2023 15:17

I was looking for a clear answer how to perform communication between front to back-end for a long time. And after that I found this tutorial, which is clear and understandable for me as a beginner. Julian Nash - thanks a lot. It gives me a milestone in my first programming project.

Ответить
Pro Grammar
Pro Grammar - 09.12.2022 05:27

You really helped me solve a big problem. Bless you

Ответить
Gabriel Luiz Suzin Scolaro
Gabriel Luiz Suzin Scolaro - 18.11.2022 19:41

How to hide this script from the client side, or can I make a post of these values and sent to the back end to do some stuff in a python program (back-ended)

Ответить
Adomas S.
Adomas S. - 09.11.2022 19:50

Thanks for great tutorial, really helped me with my project!

Ответить
CacoVenom
CacoVenom - 06.10.2022 04:43

good explanation but I really want to click and move another route by rendering a template, so far I am in the route but since is not JSON and instead is <!Doctype is giving me an error Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Ответить
erasemelater
erasemelater - 03.10.2022 12:44

Flask forms would work better in this case I believe

Ответить
juniven saavedra
juniven saavedra - 22.09.2022 23:45

Excellent resource, thank you very much. :)

Ответить
Liqua Thrushbane
Liqua Thrushbane - 17.05.2022 11:47

Gah! This video got me. Didn't see (in the previous video) about adding a {% block script %}{% blockend %} in the public_template.html so it took ages to get working. Still, enjoying the series so far.

Ответить
Ahmad Khan
Ahmad Khan - 13.03.2022 00:11

Very Helpful, thAnks to you 👍👍👍

Ответить
João Paulo Coimbra
João Paulo Coimbra - 07.02.2022 23:19

Amazed by all the talents Charlie Cox have.

Ответить
Stephen Thumb
Stephen Thumb - 01.02.2022 12:07

At its basics, it's just a way to perform API POST, GET..., directly from vanilla JS inside the DOM, then you're just communicating with your python backend as normal. For some reason that was confusing at the start.

Ответить
Bharat Chawla
Bharat Chawla - 25.01.2022 00:57

Bro you just saved my day! Thanks a ton!

Ответить
Der Komponist
Der Komponist - 05.01.2022 22:34

Hey Julian, thanks for the great video! Could you please explain how to actually return the response? i always get "Undefined"

Ответить
Bull Red
Bull Red - 18.08.2021 18:51

Saved my day ..

Ответить
Imufur
Imufur - 12.08.2021 18:29

why use this and not a request.args or request.form or something like that?

Ответить
DarkSoldier
DarkSoldier - 03.08.2021 06:04

Thanks pal, very useful tutorial, greetings from South America. Greetings fro the flask community.

Ответить
Ivan mcln
Ivan mcln - 03.07.2021 17:34

this was really fun, shame your channel's dead

Ответить
Daniel Andres Clavijo Giraldo
Daniel Andres Clavijo Giraldo - 18.06.2021 19:07

If you use Token CSRF, I recommend putting this on the headers "X-CSRF-TOKEN": csrf
Si utiliza Token Csrf, recomiendo poner esto en las cabeceras "X-CSRF-TOKEN": csrf

Example/Ejemplo:

csrf = 'Your token'

headers: new Headers({
"Content-Type": "application/json",
"X-CSRF-TOKEN": csrf
})

Ответить
Alhareth Turab
Alhareth Turab - 17.06.2021 18:15

is it possible to send octet-stream inside the json along with other types of data?

Ответить
Mạnh Dần Nguyễn
Mạnh Dần Nguyễn - 26.05.2021 19:56

Thank you very much <3

Ответить
Saurabh Agarwal
Saurabh Agarwal - 20.05.2021 22:20

very useful video.. few things need to be updated in the code to make it work error-free

Ответить
Muhammad Shafeeq
Muhammad Shafeeq - 14.05.2021 13:45

Thank you soo much for taking your time to do this. I dunno if u hear this a lot but ur special.

Ответить
Scla
Scla - 07.05.2021 15:46

Thanks for this amazing tutorial!

Ответить
Anar Abiyev
Anar Abiyev - 13.04.2021 23:25

Videos and explanation are great, but I feel like the videos go from "Flask Tutorial" to "HTML tutorial". I fully get that they are related, but I would be happier I you mainly talked about the basics and main concepts of flask without going into coding of HTML.

Ответить
KirkLHemmett
KirkLHemmett - 07.04.2021 23:03

I just completed my project seeing your video. Great help.

Ответить
Mbuzi From The HOOD
Mbuzi From The HOOD - 27.03.2021 02:46

Love your work manze.

Ответить
English Rain
English Rain - 17.03.2021 08:02

Amazing, thank you!

Ответить
Michael LK
Michael LK - 17.02.2021 00:53

you have NO IDEA, how MUCH OF A HEADACHE YOU SAVED ME. OH MY GOODNESS. THANK YOU

Ответить
Zsadez Buchanon
Zsadez Buchanon - 10.01.2021 06:43

Excellent stuff man. Thank you so much.

Ответить
yash varshney
yash varshney - 29.12.2020 13:45

Tip: Always show code link at the end of the video.

Ответить
guinea horn
guinea horn - 01.12.2020 06:59

Do you have this code up anywhere? It's a bit inconvenient to have to scrub through the video to find bits that I'm referencing in my own application.

Ответить
Boris Krasilnikovs
Boris Krasilnikovs - 27.11.2020 20:02

thank you merry much!

Ответить
Nguyễn Hải Long
Nguyễn Hải Long - 08.11.2020 02:20

It hit right the thing I want. Love your video, great content with an example from the server side. I had been struggling with all the documentation which has nothing on the server-side, and I cant understand how and where to send the fetch url, but your video saves me. So thump up for ya !

Ответить
Anna Kropornicka
Anna Kropornicka - 03.11.2020 00:02

Is there a reason an else statement is not included in the .then method?

Ответить
Christophe Dupin
Christophe Dupin - 08.09.2020 23:28

i m getting an error : Fetch error: TypeError: Failed to fetch
any idea?
how could the example work :
response.json().then(function (data)
response.json() object doesnt have any methode call then and it s note a promise

Ответить
il messia blasfemo
il messia blasfemo - 18.08.2020 17:53

get_json() was always returing a none value for me, i solved using:
req = request.get_json(force = True)

thank you btw, I was going insane before your video<3

Ответить
Sonny
Sonny - 17.08.2020 21:08

What would be the reason to use Fetch API, instead of form data as in Pt 7? (Or maybe requests if that is possible?)

Thanks! I like your videos a lot, very explanatory!
I also watched the series of Corey Shafer on Flask (which I liked BTW), but yours are more instructive and clearer so far. You use less additional libraries, which let it be more Pythonic.

Ответить
Yichuan Yu
Yichuan Yu - 16.08.2020 10:09

Thanks for the video!

A question about ${window.origin}. What programming language is that?
It does not seem to work for me, I use the below instead.
fetch(window.location.href+'getjson',{

Do you know if there is any difference?

Ответить
Blocks
Blocks - 17.07.2020 20:26

Great tutorial. Thanks!

Ответить
Mateo Scarafia
Mateo Scarafia - 14.07.2020 21:06

coooolll

Ответить
Adrian Gonzalez
Adrian Gonzalez - 24.06.2020 00:09

The best!!

Ответить
Ivan Dimic
Ivan Dimic - 12.06.2020 08:18

Thanks for your help mate! Last few days was wrapping my mind around this topic, and just clicked while watching this video.

Ответить
Pat Hess
Pat Hess - 22.05.2020 21:52

very helpful....I'll check out some more of your videos....I did spend some time running down my typos..nothing new there

Ответить
Scott Curry
Scott Curry - 12.03.2020 00:10

Awesome stuff man, this helped me a lot!

Ответить
Eduardo Amaral
Eduardo Amaral - 16.02.2020 07:04

You're an amazing teacher mate, well done!

Ответить
Jitendra
Jitendra - 29.12.2019 08:31

Thank you very very very very very.....much.
You saved project.
Thank you again.

Ответить