window.particpants = [];
window.participants['eventcode'] = "GEVENT";
window.participants['price'] = 99.00;
window.participants['WaitingList'] = "";
if(waiting_list_flag) {
window.participants['WaitingList'] = "YES";
} else {
window.participants['WaitingList'] = "NO";
}
$('#next_btn').click(function() {
addParticipant(); // adds the last entered participant info to the participants object
var url = AJAX_URL_ADD
json_data = JSON.stringify(window.participants); // json encode the participants
$.ajax({async: false,
type:'POST',
url: url,
data: json_data,
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.participants.push(participant);
} // function addParticipant()
ASKER
window.participants.eventcode = "GEVENT";
window.participants.price = 99.00;
window.participants.WaitingList = "";
ASKER
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
ASKER
Open in new window
If I leave it atOpen in new window
I getOpen in new window