【发布时间】:2017-01-01 14:49:06
【问题描述】:
我在 Flask 中有一个如下所示的应用:
app = Flask(__name__)
@app.route('/')
def start():
return render_template('page1.html') # loads the start page on the beginning
@app.route('/page2',methods=['GET','POST'])
def read():
if request.method == 'POST':
# lots of actions taking a long time
return render_template('page2.html', arg1=arg1, arg2=arg2)
我想在我的 HTML 页面上添加一张照片,该照片将显示“正在加载”,直到 page2 上传。这类似于我当前在 page1 上的 HTML:
<html>
<head>
<meta charset="UTF-8">
<title>IP / ISP Research</title>
<link rel="stylesheet"
type="text/css"
href="/static/style.css"/>
</head>
<body>
<center>
<h2>Search for something</h2>
<form class="form-style-7" action="/page2" method="POST" >
<ul>
<li>
<label for="arg1">IP</label>
<input type="text" name="arg1" value="{{arg1}}" maxlength="100">
<span>Enter arg1</span>
</li>
<li>
<label for="arg2">ISP</label>
<input type="text" name="arg2" value="{{arg2}}" maxlength="100">
<span>Enter arg2</span>
</li>
<li>
<input class="go_button" type="submit" value="GO" >
</li>
</ul>
</form>
</center>
</body>
</html>
我尝试过的事情:
主要在我的 HTML 中编写 javascript,例如 here。
还尝试为 showImage() 添加一个函数并将其添加到 HTML 表单标签:onclick="showImage()
还尝试将其添加到 HTML 按钮标签:onSubmit="return showImage()
【问题讨论】:
标签: javascript jquery python html flask