librelist archives

« back to archive

Flask hangs when Form Submitted

Flask hangs when Form Submitted

d hee
2013-09-22 @ 05:52

I can not send a form to Flask. If I do xml.send(null), my flask script 
works with no issues. But if I do xml.send(form) it hangs and does not 
return. I am using flask-0.10.1-r1 along with uwsgi 1.4.10. Here is my 
code...if anyone could please help:

one@chat-dash:/var/www/dude/js$ cat main.js 
function jackpot() {
            var form = new FormData();
    var fname = "hello there";
    form.append("filename", fname);
    var xml = new XMLHttpRequest();"POST", "/site/myapp/bob", true);
    xml.onreadystatechange = function () {
                      if (xml.readyState == "4" && xml.status == "200"){

import flask, flask.views
app = flask.Flask(__name__)

class View1(flask.views.MethodView):
    def get(self):

    def post(self):
return "hello world"
#return str(flask.request.form('filename'))

app.add_url_rule('/site/myapp/bob', view_func=View1.as_view('bob'))