Update
Update server data recieve
This commit is contained in:
parent
9abe49c321
commit
d4602283eb
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
main.py
|
2
.idea/MarioWeb.iml
generated
2
.idea/MarioWeb.iml
generated
@ -5,7 +5,7 @@
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="VisMOO" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="VisMOO" project-jdk-type="Python SDK" />
|
||||
</project>
|
18
main.py
18
main.py
@ -193,21 +193,27 @@ def gameannoresult2(id):
|
||||
return redirect(url_for("gameplay2", id=id))
|
||||
|
||||
|
||||
@app.route("/gameover")
|
||||
@app.route("/gameover",methods=['POST','GET'])
|
||||
def over():
|
||||
finish = idm.getTimes(getId())
|
||||
return render_template("GameOver.html", finish=1, stage=1)
|
||||
|
||||
|
||||
@app.route("/gameover/<id>/feedback", methods=['POST'])
|
||||
def overa():
|
||||
if request.method == 'POST':
|
||||
resultList = list(request.form)[0].split(",")
|
||||
idm.write_csv(feedbackPath,
|
||||
[getId(), resultList[0],
|
||||
""])
|
||||
|
||||
return render_template("GameOver.html", finish=1, stage=1)
|
||||
|
||||
|
||||
# @app.route('/feedback', methods=['POST'])
|
||||
# def overa():
|
||||
# if request.method == 'POST':
|
||||
# resultList = list(request.form)[0].split(",")
|
||||
# idm.write_csv(feedbackPath,
|
||||
# [getId(), resultList[0],
|
||||
# ""])
|
||||
|
||||
# return redirect(url_for("over", id=id))
|
||||
def saveFile(path, filename, content):
|
||||
cp = list(map(int, content))
|
||||
file_dir = os.path.join(os.getcwd(), path)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="en">
|
||||
<script
|
||||
id="allow-copy_script">(function t() { var t = !1; document.addEventListener("allow_copy", (function (n) { t = n.detail.unlock })); var n = ["copy", "cut", "contextmenu", "selectstart", "mousedown", "mouseup", "mousemove", "keydown", "keypress", "keyup"], e = function (n) { t && (n.stopPropagation(), n.stopImmediatePropagation && n.stopImmediatePropagation()) }; n.forEach((function (t) { document.documentElement.addEventListener(t, e, { capture: !0 }) })) })()</script>
|
||||
|
||||
<script src="../templates/Web/jquery.min.js"></script>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<script src="https://cjrtnc.leaningtech.com/2.3/loader.js"></script>
|
||||
@ -189,9 +189,10 @@
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<form id="ajaxform">
|
||||
<h3>Do you have any feedback?</h3>
|
||||
<br>
|
||||
<form method="POST" action="feedback">
|
||||
<textarea
|
||||
id="message"
|
||||
cols="60"
|
||||
@ -200,7 +201,7 @@
|
||||
|
||||
></textarea>
|
||||
<br><br>
|
||||
<input type="submit" value="Submit" class="cirButton">
|
||||
<input type="submit" value="Submit" class="cirButton" onclick="submit_it()">
|
||||
</form>
|
||||
<script>
|
||||
document.getElementById("hideButton").addEventListener("click", function () {
|
||||
@ -217,6 +218,32 @@
|
||||
// var newWindow = window.open("", "_self");
|
||||
// newWindow.close();
|
||||
// });
|
||||
|
||||
function submit_it() {
|
||||
$("#ajaxform").hide()
|
||||
$("#ajaxform").submit(function(e)
|
||||
{
|
||||
|
||||
var postData = JSON.stringify($("#message").val());
|
||||
{#var formURL = $(this).attr("action");#}
|
||||
$.ajax(
|
||||
{
|
||||
url : "gameover",
|
||||
type: "POST",
|
||||
data : postData,
|
||||
success:function(data)
|
||||
{
|
||||
|
||||
//data: return data from server
|
||||
}
|
||||
|
||||
});
|
||||
e.preventDefault(); //STOP default action
|
||||
{#e.unbind(); //unbind. to stop multiple form submit.#}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</div>
|
||||
@ -250,7 +277,7 @@
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap core JavaScript -->
|
||||
<script src="../templates/Web/jquery.min.js"></script>
|
||||
|
||||
<script src="../templates/Web/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<!-- Plugin JavaScript -->
|
||||
|
Loading…
Reference in New Issue
Block a user