Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:21:05+00:00 2026-06-13T17:21:05+00:00

I have a list of image names loaded with flask, which I am rendering

  • 0

I have a list of image names loaded with flask, which I am rendering to an html template, so that the page displays the image. The only way I can seem to alter the image list (ie. add an image to it) is to make a view which contains code to change the list, but in order to access the view you have to reload the whole page again. Is there any way I can alter the list with flask without having to reload the whole page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:21:07+00:00Added an answer on June 13, 2026 at 5:21 pm

    Jakob Bowyer is absolutely correct – use ajax:

    from flask import jsonify
    from werkzeug.security import safe_join
    
    @app.route("/gallery")
    def gallery():
        images = get_images_from_dir("some/base/path/*.jpg")
        return render_template("gallery.html", images=images)
    
    
    @app.route("/search/images", methods=["POST"])
    def search_images():
        glob_path = request.form["image_query"]
        glob_path = safe_join("/some/base/path", glob_path)
        return jsonify(images=get_images_from_dir(glob_path))
    

    Then in your template just hit the appropriate endpoint:

    <!-- snip -->
    <script>
    // jQuery here - you can use anything you want :-)
    $.post({
        url: "{{ url_for("search_images") }}",
        success: function(data) {
            console.log(data);
        },
        error: function() { console.log("Error", arguments); }
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a page that has a grid/list dynamically loaded via AJAX, an efficient way
I have implemented a Custom List View which displays text along with image. The
So I have a UITableView that has a list of image names and corresponding
I have a list of image paths in my PHP script that I would
I have a custom list, and I've added a 'Page Image' field by clicking
I have a page that has a listbox with the following item template as
I have a UITableViewController with a list of image names. When a name is
I have a list of items(names of image) in a isolated storage. If i'm
I have a list of product names and their image, as I want to
I have a table view that displays a list of users. The avatar images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.