[英]Auto-submit Form on dropdown selection *without* clicking submit button? AJAX/PHP
[英]How to auto-submit(without clicking submit button) the form , 2 seconds after the user has typed in the data
我想将表单数据提交到数据库,用户在表单中输入数据后2秒
我正在使用 ajax 函数来完成这个。但是当按下一个键时表单被提交
$('#eid').bind('input propertychange', function() {
$.ajax({
method: "POST",
url: "intime2.php",
data: { content: $("#eid").val() }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
});
当我在表单中输入员工 ID=12 时。 我希望结果以 12 的形式存储在数据库中,但存储的结果为 1。在按 2 提交数据之前。 我还希望每次连续提交时自动刷新表单。
我的目标:员工应该输入他们的员工 ID(我打算从读卡器中取出,但现在我喜欢使用超时功能)在输入表单后应该自动提交而不按提交按钮然后表单应该刷新和下一步员工应输入其员工 ID
使用 debounce 功能将表单数据提交到服务器
参考: jQuery 中的去抖动函数https://davidwalsh.name/javascript-debounce-function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.