Jquery 如何实现select,以便在用户单击提交按钮时可以访问代码中的SELECTED值
我正在制作一个基于Flask的简单上传程序,从获取文件到保存文件,一切都在进行中。我的问题是如何实现select,以便在用户单击submit按钮时可以访问代码中的SELECTED值,最好用户必须选择其中一个值 模板中Jquery 如何实现select,以便在用户单击提交按钮时可以访问代码中的SELECTED值,jquery,python,html,python-2.7,flask,Jquery,Python,Html,Python 2.7,Flask,我正在制作一个基于Flask的简单上传程序,从获取文件到保存文件,一切都在进行中。我的问题是如何实现select,以便在用户单击submit按钮时可以访问代码中的SELECTED值,最好用户必须选择其中一个值 模板中 要访问烧瓶中用户提供的任何值,可以使用。request是与请求上下文关联的本地线程,可用于访问: 通过e查询字符串参数。g/some/url?this=params&right=here 来自表单帖子等的URL编码正文参数,通过: 通过request.get_JSON对JSON编码
要访问烧瓶中用户提供的任何值,可以使用。request是与请求上下文关联的本地线程,可用于访问: 通过e查询字符串参数。g/some/url?this=params&right=here 来自表单帖子等的URL编码正文参数,通过: 通过request.get_JSON对JSON编码的实体,通过request.cookies对cookie数据进行编码,更多详细信息请参见
你有没有见过这些人?如果是的话,有什么不清楚的提示请求。表格['choose']?谢谢你,问题解决了,请你以一种正式的方式发布它,以便我可以接受它作为答案。
<div>
<form action="upload" method="post" enctype="multipart/form-data">
<div style="position:relative; overflow:hidden;">
<a class='btn btn-primary' href='javascript:;'>
Choose document
<input type="file" style='position: absolute;top: 0;right: 0;min-width: 100%;min-height: 100%;font-size: 999px;
text-align: right;filter: alpha(opacity=0);opacity: 0;outline: none;background: white;cursor: inherit;display: block;'
name="file" id ="Mfile" size="40" onchange='$("#upload-file-info").html($(this).val());'>
</a>
<span class='label label-info' id="upload-file-info"></span>
</div>
<br/>
<br/>
<select name = "choose" class="form-control">
<option value="cop">Computer programming</option>
<option value="bio">Biology</option>
<option value="mth">Math</option>
<option value="soc">Sociology</option>
<option value="psy">Psychology </option>
</select>
<br/>
<button type="submit" class="btn btn-success">
<i class="icon-circle-arrow-right icon-large"></i> Submit
</button>
</form>
</div>
@main.route('/upload', methods=['POST'])
@login_required
def upload():
file = request.files['file']
...
...
request.args['these'] # "params"
request.args['right'] # "here"
<!-- in your html -->
<form action="/do-stuff" method="post">
<input name="these" value="params">
<input name="right" value="here">
<input type="submit">
</form>
# In your script
request.form['these'] # "params"
request.form['right'] # "here"