【发布时间】:2018-02-04 15:13:48
【问题描述】:
晚上好, 我正在使用加载不同表单的方法导入,这些表单在提交时会发生变化,不幸的是,在使用 ajax 后,这些元素没有被 javascript 记录,我找到了我的 prolet 的答案,但我无法纠正它...
我的 test.php 文件只是返回一个文本并使用表单提交输入 ^^ 谢谢!
$("#voteform").load("test.php", { });
$(document).ready(function() {
$("#vote").submit(function () {
alert('test');
$("#voteform").load("test.php", {
username: $("#username").val()
});
return false;
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>WorldCube.fr || Votes</title>
<link rel="stylesheet" href="vote.css">
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div class="votesystem center">
<div class="votetitle">
</div>
<div id="voteform" class="voteform">
</div>
</div>
</body>
</html>
【问题讨论】:
标签: javascript html ajax submit refresh