Response title
This is preview!
window.attendees = {};
window.attendees.eventcode = "GEVENT";
window.attendees.price = 99.00;
window.attendees.WaitingList = "";
window.attendees.participants = [];
if(waiting_list_flag) {
window.attendees.WaitingList = "YES";
} else {
window.attendees.WaitingList = "NO";
}
$('#next_btn').click(function() {
addParticipant(); // adds the last entered participant
// info to the participants object
// see below
var url = AJAX_URL_ADD;
$.ajax({async: false,
type:'POST',
url: url,
data: window.attendees,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(data){
if(data.result=='success') {
window.location = GOTO_URL;
} else {
//display error
$('.error_message').html(data.message);
} // if(data.result=='success')
} // success function()
}); // $.ajax
}); // $('#next_btn').click
// also called from another button click to add more participants
function addParticipant() {
var participant = {};
participant.firstname = $('#FirstName').val();
participant.lastname = $('#LastName').val();
participant.email = $('#Email').val();
window.attendees.participants.push(participant);
} // function addParticipant()
© 2013 jQuery Foundation
Sponsored by and others.