I am using AJAX to submit a form, and would like to display a summary of the information on the page so that the user can confirm the information before submitting. I am having trouble getting the results to display on multiple lines. Any suggestions on the best way to do this?
Here is the PHP:
$return['message'] = 'First Entry: ' . $_POST['Name1'] . ' ' . 'Second Entry: ' . $_POST['Name2'] . ' ' . 'Third Entry: ' . $_POST['Name3'];
echo json_encode($return);
Here is the jQuery:
$("#mark-form").validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
type: "POST",
data: {
"Name1" : $('#Name1').val(),
"Name2" : $('#Name2').val(),
"Name3" : $('#Name3').val()
},
dataType: 'json',
url: './includes/ajaxtest3.php',
error: function() {alert("Error");},
success:
function(data) {
$('<div id="output2"></div>').insertAfter($('#agreement-information'));
$('#output2').html(data.message).show(500);
$('#ouput2').append(data);
},
});
return false;
},
errorPlacement: function(error,element) {
return true;
},
rules: {
"Name1": {
required: true,
}
}
});