diff --git a/app.py b/app.py index 6f1437f..bf54470 100644 --- a/app.py +++ b/app.py @@ -11,8 +11,7 @@ def drawPlz(): name = request.form.get('lostobject') msg = "Sorry that you lost {name}. But {name} will be having fun somewhere." if request.method == 'POST': - print("is this workhing?") - image=request + image = request.form["data"] print(image) return render_template("drawing.html", title=title, msg=msg) @@ -28,7 +27,8 @@ def index(): # Read the values from the form element. name = request.form.get('lostobject', 'nana') text = request.form.get('text', 'haha') - + print(text) + # date = request.form['dd-mm-yyyy'] Q.How can I include date? Or maybe general date input? Sometimes ppl do remember when they lose sth. and somethimes they do not know. # Write the submitted data to a file, which is @@ -51,4 +51,4 @@ def index(): if __name__ == '__main__': APP.debug = True - APP.run(port = 5000) \ No newline at end of file + APP.run(port = 5000) diff --git a/static/main.js b/static/main.js index 6e051cc..36c35e3 100644 --- a/static/main.js +++ b/static/main.js @@ -97,7 +97,8 @@ var xhr = new XMLHttpRequest(); function sender(){ xhr.open("POST", "/2ndpage", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); - someStuff=document.getElementById("svgElement"); - xhr.send(someStuff); - console.log("I'm sending") + someStuff=document.getElementById("svgElement").innerHTML; + xhr.send("data="+someStuff); + console.log(someStuff); + console.log("I'm sending"); }