app/assets/javascripts/jqr-helpers.js in jqr-helpers-1.0.23 vs app/assets/javascripts/jqr-helpers.js in jqr-helpers-1.0.24
- old
+ new
@@ -203,10 +203,21 @@
if (element.is('form') &&
$(ujsSubmitElement).parents('form').index(element) >= 0)
disableElement = ujsSubmitElement;
hideThrobber(disableElement);
var targetElement = element;
+
+ if (element.data('redirect') &&
+ (data.indexOf('http') == 0 || data[0] == '/')) {
+ window.location = data;
+ return;
+ }
+ else if (!element.data('callback') && data &&
+ data.trim().charAt(0) != '<' && data != 'success') {
+ alert(data);
+ return;
+ }
// if this was sent from a dialog, close the dialog and look at the
// element that opened it for update/append/delete callbacks.
if ($('.ui-dialog:visible').length) {
if (element.data('use-dialog-opener'))
targetElement = ujsDialogElement;
@@ -215,20 +226,12 @@
}
if (element.data('refresh')) {
window.location.reload();
return;
}
- else if (element.data('redirect') && data.indexOf('http') == 0) {
- window.location = data;
- return;
- }
if (element.data('callback')) {
var callback = eval(element.data('callback'));
callback.call(targetElement, data);
- }
- else if (data && data.trim().charAt(0) != '<' && data != 'success') {
- alert(data);
- return;
}
var selector = element.data('selector');
var target = null;
if (selector) {
if (selector[0] == '#') target = $(selector);