I have html form:
<form id = "contactForm">
<input type="text" name="name"></input>
<input type="text" name="phone"></input>
</form>
I have Button and when I click it I am doing ajax post request:
$.post( "/send-form", $('#contactForm').serialize()
In chrome web inspector I can see that data is sent name=+gfdsfd&phone=89999
This is my backend function I am using Flask,Python:
@app.route("/send-form", methods=['POST'])
def send_form():
name = phone = email = country = text = None
data = request.data
print request.data
And it prints empty string in my console. What can be the problem?
To access Flask's form data you should use the form attribute of the request object .