这是我的用于ajax表单提交的js函数:
$('.sendButton').on('click', function(){
$.post( "/send-form", $('#contactForm').serialize())
}
这是我的表格:
<form id="contactForm">
<input id="fastName" name="name" type="text" />
<input id="fastPhone" name="phone" type="text" />
<div class="sendButton">send</div>
</form>
这是我的后台函数,我用的是python,flask
@app.route("/send-form", methods=['POST'])
def send_form():
data = request.data
print request.data
在我的控制台上它打印数据:
127.0.0.1 - - [22/Feb/2015 23:50:54] "POST /send-form HTTP/1.1" 200 - name=dfdsf&phone=89920203725
但我在另一个项目中也做了同样的事,它什么也没印出来。 详情如下: Can't get post ajax request data python 这怎么可能?
目前没有回答
相关问题 更多 >
编程相关推荐