After Flask post, the background processing completes the parameter transfer update page?

the interface written with Flask, you want to click on the string on the page, and then return the string to python,python after processing, and then return it to the front end, which is displayed on a blank page. I just came into contact with flask. I still don"t understand. I"d like to ask you how to do it.

I want to click on the agent below, and then after python has processed it, I return the details of the agent in the space on the right.

clipboard.png

question 1: how to do this?
question 2: if I don"t update the same interface, do I want to use url_for to construct an interface for each proxy string? how do I do that?

Code for html view

/ / want to display the details of the agent on the same page < div id= "section_2" > < / div? Place

<div id="section_header">
    <h3 align="right"> Current date/time: {{ current_time | datetimefilter }}</h3>
</div>
<div id="section_1">

    <P align="right"> :   </P>
    {% for proxy in IP_PORT %}
    <p align="right"><a href="-sharp">{{proxy}}       {{IP_PORT[proxy]}}</a>

{% endfor %} </div> <div id="section_2"> </div> </div>

here is the code in python

/ / the data is taken from Redis, and the function for handling the agent is in another file

.
@app.route("/proxypool_list")    
def proxypool_list():
redis = RedisClient()
proxy_list = redis.list()
proxy_list = sorted(proxy_list, key=lambda x : x[1],reverse=True)

IP = [proxy_list[i][0] for i in range(0,len(proxy_list))]
PORT = [proxy_list[i][1] for i in range(0,len(proxy_list))]
IP_PORT = dict(zip(IP, PORT))

return render_template(
    "proxypool_list.html",IP_PORT=IP_PORT,current_time=current_time)

Apr.15,2021

according to your requirement description, you actually need to take two steps:

  1. Click the string on the page and return it to python. you can set up a url_for () link on your page. After clicking it, you need to use your custom flask views view function.
  2. After the python processing is completed, it is returned to the front end and displayed on a blank page . In this step, I first figure out a definition: is displayed on a blank page , which I understand as a completely new blank page. You can use your flask views view function to return a new page through render_template ().
  3. After a closer look at
  4. , your requirement is to return the details of the agent in the space to the right of . This is the need for to implement the local refresh function . This requires you to use the relevant functions of ajax. You need to be familiar with the relevant features of JavaScript.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47cc7-43bdb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47cc7-43bdb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?