From 5e29aebeb614b88e1d03088f487517a1b67bd24e Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 9 Dec 2015 13:34:52 +0800 Subject: [PATCH] Prevented page from redirecting before JS had finished --- yui/src/rearrange.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/yui/src/rearrange.js b/yui/src/rearrange.js index ff0188c..773b0fa 100644 --- a/yui/src/rearrange.js +++ b/yui/src/rearrange.js @@ -309,11 +309,16 @@ M.mod_customcert.rearrange = { on: { failure: function(tid, response) { this.ajax_failure(response); - e.preventDefault(); + }, + success: function() { + var formNode = e.currentTarget.ancestor('form', true); + window.location = formNode.getAttribute('action') + '?' + Y.QueryString.stringify({cmid:formNode.one('[name=cmid]').get('value')}); } }, context: this - }) + }); + + e.preventDefault(); },