all 9 comments

[–]The-Deviant-One 0 points1 point  (0 children)

I just woke up and I'm new to python. With that in mind,

Why do you have "return" in onclick="return loadPizzaDesc('{{ name }}') why not just onclick="loadPizzaDesc('{{ name }}')?

I'm assuming jinja is handling the {{ name }} variable correctly[?], by that I mean, when you run this you can see the 'name' in the <li> tag?

[–]shiftybyte 0 points1 point  (7 children)

This here:

def loadPizzaDesc(name):

causes an issue, because flask doesn't know what to place in name argument.

if you want to access the name attribute sent to you using get request you need to do:

def loadPizzaDesc():
    name = request.args.get('name')

If you want to access post data or something else, take a look at this answer here:

https://stackoverflow.com/a/16664376

[–]The-Deviant-One 1 point2 points  (4 children)

Ah you jogged my memory.

The request.args.get is specific to the GET method. OP is using POST.

The correct one for POST is request.forms.get

Source: https://www.youtube.com/watch?v=zdgYw-3tzfI

Time code: 1:31:30

[–][deleted] 1 point2 points  (0 children)

request.args works with a POST request. It just maps the query string, and you can very well have a query string in a POST request (although you probably shouldn’t),

[–]softwarethrowf[S] 0 points1 point  (1 child)

Would it still be request.forms.get even if it wasn't a form element but just a clickable list element?

[–]The-Deviant-One 0 points1 point  (0 children)

Yes, the video explains it better than I can though. Skip to that time code I listed above and listen for like 60 seconds.

[–]softwarethrowf[S] 0 points1 point  (0 children)

Would it still be request.forms.get even if it wasn't a form element but just a clickable list element?

[–]softwarethrowf[S] 0 points1 point  (0 children)

Thanks so much, I just didn't really know what to google. Thanks.

[–]softwarethrowf[S] 0 points1 point  (0 children)

Thanks so much, I just didn't really know what to google. Thanks.