I have a new website. In this website, the user enters values in the Name & Email in text fields and then the user clicks an anchor to get a unique link.
Now the thing is, I want to save data from input type text
(Name & Email). I know how to do it if there is a submit button, but how can I save data without a submit button?
I want to save data in a database via PHP.
You can use Javascript to submit your form without using a submit button. Use the code written below and modify it accordingly:
<form name="myform">
<input type="text" />
<button class="buttonFinish"></button>
</form>
<script type="javascipt">
$(document).ready(function() {
$('.buttonFinish').click(function(){
$('.myform').submit();
});
}
</script>
通过检查if(keycode =='13')在key enter上进行AJAX调用,并通过验证来调用服务器端方法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.