Table of Content
Feedback form view
1// Feedbacks View Module 2app.view.Feedbacks = (function(){ 3 // expected data is array of object with name, email, message as key in each object. 4 function FeedbacksView(){ 5 } 6 // posting view 7 FeedbacksView.prototype.handlePostButton = function() { 8 $('#feedback-submit').click(function(){ 9 var name = $('#feedback-name').val(); 10 var message = $('#feedback-message').val(); 11 var email = $('#feedback-email').val(); 12 (new app.Feedbacks()).post(name, email, message, function(){ 13 $('#feedback-name').val(''); 14 $('#feedback-email').val(''); 15 $('#feedback-message').val(''); 16 alert('Feedback sent. Thanks.'); 17 }); 18 }); 19 } 20 return FeedbacksView; 21})();
And we glue them together
What’s next? We’re going to take a look at “More controls”.