Questionnaire-of-the-Facebo.../public/assets/action.js

23 lines
729 B
JavaScript
Raw Normal View History

2021-03-10 19:01:44 +00:00
// jQuery that will "listen" to the html niceSurvey.html
2021-03-11 23:56:57 +00:00
$(document).ready(function() {
2021-03-10 19:01:44 +00:00
2021-03-11 23:56:57 +00:00
$('form').on('submit', function() {
2021-03-10 19:01:44 +00:00
2021-03-11 23:56:57 +00:00
// var item = $('form input');
// console.log(item.serializeArray());
$.ajax({
type: 'POST',
url: '/survey',
data: $(this).serializeArray(),
success: function(data) {
// do something with the data via front-end framework
// Make the submit button red, disabled and saying Thank you
$("#bb").css("background-color", "red");
$("#bb").prop("disabled", "true");
$("#bb").text("Thank you!");
}
});
return false;
});
});