Skip to Main Content
Learning Flask Framework
book

Learning Flask Framework

by Matt Copperwaite, Charles Leifer
November 2015
Beginner content levelBeginner
250 pages
5h 16m
English
Packt Publishing
Content preview from Learning Flask Framework

Loading comments using AJAX

Now that we are able to create validated comments using AJAX, let's use the API to retrieve the list of comments and display them beneath the blog entry. To do this, we will read the values from the API and dynamically create DOM elements to display the comments. As you might recall from the earlier API responses we examined, there is quite a bit of private information being returned, including the entire serialized representation of each comment's associated Entry. For our purposes, this information is redundant and will furthermore waste bandwidth.

Let's begin by doing a bit of additional configuration to our comments endpoint to restrict the Comment fields we return. In api.py, make the following addition to the call ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Flask Framework Cookbook - Second Edition

Flask Framework Cookbook - Second Edition

Shalabh Aggarwal
Flask Framework Cookbook

Flask Framework Cookbook

Shalabh Aggarwal

Publisher Resources

ISBN: 9781783983360Supplemental Content