嗨,任何人都可以帮我解决这个问题,请发布整个代码,因为我真的是编码的菜鸟,并且已经失去了很多时间寻找正确的答案。如果我想投票给这个游戏,请在本页面上看到“spielbewertung” 的 http://www.spielonline.ch/spiel.php/Kogama-Ostry.html 页面在投票后从页面spiel.php加载iframe nickolodeonspelheader.php,网址看起来像这样 http://www.spielonline.ch/ nickelodeonspelheader.php /Kogama-Ostry.html哪个offcourse是错误的,它应该在输入后更改数据库中的数据并返回到原始父页面,以便游戏可以在之后播放表决。这是表单代码:
<table style="display: inline-block;"><tr>
<td class="top" colspan="1" width="100%"><h2>Spielbewertung</h2></td></tr>
<tr><td width="50%" style="align:left;">
<form name="rating" action="" method="post">
<p style="font-family: tahoma; font-size: x-small;">
<b>Spiel bewerten:</b>
<select name="number">
<option value="">-</option>
<option value="3">3 = sehr schlecht</option>
<option value="4">4 = mangelhaft</option>
<option value="5">5 = langweilig</option>
<option value="6">6 = ausreichend</option>
<option value="7">7 = befriedigend</option>
<option value="8">8 = gut</option>
<option value="9">9 = sehr gut</option>
<option value="10">10 = hervorragend</option>
</select>
<input type="submit" name="vote" value="bewerten" style="cursor: pointer" />
</p>
</form>
</td></tr>
</table>
非常感谢您的帮助!
答案 0 :(得分:0)
也许你可以使用这篇文章中的建议:callback when form submitted using submit() method 并用location.reload();
替换alert(“done”)例如:
<!-- Import jQuery in your <head> tag -->
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<!-- your html source -->
<table style="display: inline-block;"><tr>
<td class="top" colspan="1" width="100%"><h2>Spielbewertung</h2></td></tr>
<tr><td width="50%" style="align:left;">
<!-- Add id attribute for form -->
<form id="submit-form" name="rating" action="" method="post">
<p style="font-family: tahoma; font-size: x-small;">
<b>Spiel bewerten:</b>
<select name="number">
<option value="">-</option>
<option value="3">3 = sehr schlecht</option>
<option value="4">4 = mangelhaft</option>
<option value="5">5 = langweilig</option>
<option value="6">6 = ausreichend</option>
<option value="7">7 = befriedigend</option>
<option value="8">8 = gut</option>
<option value="9">9 = sehr gut</option>
<option value="10">10 = hervorragend</option>
</select>
<input type="submit" name="vote" value="bewerten" style="cursor: pointer" />
</p>
</form>
</td></tr>
<script>
$form = $("#submit-form");
$form.on("submit",function()
{
alert("submitting..");
//do ajax
$.ajax({
url:<submit url>,
type:post,
success:function() {
location.reload();
}
});
});
$form.submit();
</script>
</body>