- Improved the 'ajax form' it now uses the form method to create the ajax call (thanks to Felipe De Boni for suggesting this fix)

This commit is contained in:
Nanne Baars 2016-09-12 21:37:00 +02:00
parent 8e9bebacd7
commit 7fa63cec81

View File

@ -24,15 +24,16 @@ define(['jquery',
//TODO: reimplement this in custom fashion maybe? //TODO: reimplement this in custom fashion maybe?
makeFormsAjax: function () { makeFormsAjax: function () {
var $form = $('form');
var options = { var options = {
success:this.reLoadView.bind(this), success:this.reLoadView.bind(this),
url: this.model.urlRoot, url: this.model.urlRoot,
type:'POST' type: $form.attr('method')
// $.ajax options can be used here too, for example: // $.ajax options can be used here too, for example:
//timeout: 3000 //timeout: 3000
}; };
//hook forms //TODO: clarify form selectors later //hook forms //TODO: clarify form selectors later
$("form").ajaxForm(options); $form.ajaxForm(options);
}, },
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs