This commit is contained in:
Jason White
2016-10-11 09:20:39 -04:00
parent 829dcd2b29
commit 7d2f1f0a3a
3 changed files with 19 additions and 0 deletions

View File

@ -49,17 +49,30 @@ define(['jquery',
this.$el.find(this.$contentPages[this.currentPage]).show();
this.addPaginationControls();
}
makeFormsAjax: function() {
var options = {
success:this.onAttackExecution.bind(this),
url: this.model.urlRoot.replace('\.lesson','.attack'),
type:'GET'
// $.ajax options can be used here too, for example:
//timeout: 3000
};
//hook forms //TODO: clarify form selectors later
$("form.attack-form").ajaxForm(options);
},
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs
var self = this;
// The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below.
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
$('form').submit(function(event){
$.get(this.action, "json")
//.done(self.reLoadView.bind(self))
.fail(function() { alert("failed to GET " + url); });
});
},
onAttackExecution: function(feedback) {