Now, I need to add some function to the old code which was written with Backbone.js. So, I am trying to write it and it seems works fine as below.
JavaScript
getDetailedInfo: function(e){
this.$('#get_detailed_info').click((function(){
return function(e){
$.ajax("/api/v1/internal/car_details_search", {
}).done(function(data) {
console.log(data)
});
}
})(this));
},
html
<button class="btnSmall" id="get_detailed_info" type="submit">get information</button>
but I got an order from reviewer that I should use "events" to fire the event.
So, I made my code just easy and tried to see if the events works, and rewrite it with "events" as below but nothing fires.
JavaScript
events: {
"click button.cancel": "goBack",
},
goBack: function(){
console.log("Goback")
},
html
<button class="moreBtn thirdly cancel">Cancel</button>
I have no idea how to fix it. Please help me if you know anything about this issue.