Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
111
rated 0 times [  117] [ 6]  / answers: 1 / hits: 16521  / 14 Years ago, mon, january 24, 2011, 12:00:00

I know this is simple but I can't figure it out today and I can't find the right solution.



I have a series of tabs which populate data. At the end is a confirmation tab. At this point they can click a 'submit' button. When this button is pressed a hidden form is populated with all the relevant data. I'd like this form to then be submitted but I can't figure out how to submit the form with JQUery. I've attempted to do a trigger on the button but perhaps I'm doing it wrong. Below is a sample of the code for the button taht gets clicked. Note the values populate, I just can't get the form to submit



  $('#submitAppointment').click(function() {
$(# + formName + schedule_id option[value=' + $(input[name='appointmentTime']:checked).val() + ']).attr('selected', 'selected');
$(# + formName + apt_date).val($(#confirmDate).text());
$(# + formName + first_name).val($(#confirmFirstName).text());
$(# + formName + last_name).val($(#confirmLastName).text());
$(# + formName + email).val($(#confirmEmail).text());
$(# + formName + phone).val($(#confirmPhone).text());
$(# + formName + notes).val($(#confirmNotes).text());
$('#appt_form').submit(function() {
alert('Handler for .submit() called.');
return false;
});
});


Any ideas on what I'd need to do to rigger the submit function?


More From » jquery

 Answers
8

How about



$('#appt_form').submit();


Don't return false from the handler function if you want the form submission to actually proceed. If your intention is to have the form post without the page refreshing, then you're talking about an ajax operation for which you could use $.post(). (It's not clear that that's what you want to do however.)


[#94079] Friday, January 21, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
isaacvalentinn

Total Points: 325
Total Questions: 120
Total Answers: 131

Location: North Korea
Member since Tue, Jun 16, 2020
4 Years ago
isaacvalentinn questions
Mon, Jan 18, 21, 00:00, 3 Years ago
Mon, Nov 23, 20, 00:00, 4 Years ago
Wed, Sep 23, 20, 00:00, 4 Years ago
;