[英]Loop jQuery form post multiple times
I load an external php page in a <div>
with a $_POST
- form like this: 我在
<div>
使用$_POST
加载外部php页面-形式如下:
$("#tblStudents").on("click", "tr", function(e) {
var row_id = $("td:first a.ajaxCall", this).attr("rel");
$("#ajaxContent").show().html("<div id='wait'></div>");
$.ajax({
url: "/pages/editstudent.php",
data: {
'student_id': row_id
},
success: function(data) {
$("#ajaxContent").html(data);
}
});
});
Now it seems that when I'm inside the <div>
and do a form submit I can only do it once - then the script stop running. 现在看来,当我进入
<div>
并提交表单时,我只能执行一次-然后脚本停止运行。 How can I edit my code to allow it multiple times? 如何编辑我的代码以允许多次? I guess I need to stop and start a function somewhere but where and how?
我想我需要在某个地方停止并启动一个函数,但是在哪里以及如何进行?
I solved it myself. 我自己解决了。 I had another script echoing out the status of the form submission and that element had a
fadeout(4000)
. 我还有另一个脚本
fadeout(4000)
表单提交的状态,并且该元素具有fadeout(4000)
。 I was simply to fast on my submissions when I tested and didn't let the fadeout complete 当我测试时,我只是想快点提交,而不要让淡出完成
$("#tblStudents").on("click", "tr", function(e) {
var row_id = $("td:first a.ajaxCall", this).attr("rel");
$("#ajaxContent").empty(); //empty first before appending to avoid append repitition
$.ajax({
url: "/pages/editstudent.php",
data: {
'student_id': row_id
},
success: function(data) {
$("#ajaxContent").append(data); //TRY TO USE OF .append() not .html() maybe
}
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.