【发布时间】:2015-02-23 02:43:32
【问题描述】:
我有html表单:
<form id = "contactForm">
<input type="text" name="name"></input>
<input type="text" name="phone"></input>
</form>
我有 Button,当我点击它时,我正在执行 ajax 发布请求:
$.post( "/send-form", $('#contactForm').serialize()
在 chrome web 检查器中 我可以看到数据已发送 姓名=+gfdsfd&电话=89999
这是我使用 Flask,Python 的后端函数:
@app.route("/send-form", methods=['POST'])
def send_form():
name = phone = email = country = text = None
data = request.data
print request.data
它会在我的控制台中打印空字符串。 可能是什么问题?
【问题讨论】:
标签: jquery python ajax forms python-2.7