Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
18
rated 0 times [  20] [ 2]  / answers: 1 / hits: 19445  / 14 Years ago, mon, november 1, 2010, 12:00:00

I am trying to save the form onkeyup action. I am new to jQuery.


Is this possible?


I appreciate any help.


edit 1:
Save the form means save to server. Is there a way to add 0.2 seconds delay.


More From » jquery

 Answers
53

This code will submit your form on keyup



$('#element').bind('keyup', function() { 
$('#form').delay(200).submit();
});


In this code you intercept the form submit and change it with an ajax submit



$(#form).submit(function (event) {
event.preventDefault();
$.ajax({
type: post,
dataType: html,
url: '/url/toSubmit/to',
data: $(#form).serialize(),,
success: function (response) {
//write here any code needed for handling success }
});
});


To use the delay function you should use jQuery 1.4. The parameter passed to delay is in milliseconds.


[#95117] Friday, October 29, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maya

Total Points: 418
Total Questions: 116
Total Answers: 112

Location: Mauritania
Member since Sun, Oct 17, 2021
3 Years ago
;