ignore comments in xml when indexing; make-xml-zip script
[wolnelektury.git] / wolnelektury / static / js / dialogs.js
index 0793a7f..bf9d94b 100755 (executable)
                     hash.w.show();
                 },
                 onLoad: function(hash) {
-                    $('form', hash.w).each(function() {this.action += '?ajax=1';});
+                    $('form', hash.w).each(function() {
+                        if (this.action.search('[\\?&]ajax=1') != -1)
+                            return;
+                        if (this.action.search('\\?') != -1)
+                            this.action += '&ajax=1';
+                        else this.action += '?ajax=1';
+                    });
                     $('form', hash.w).ajaxForm({
                         dataType: 'json',
                         target: $('.target', $window),
                         success: function(response) {
                             if (response.success) {
                                 $('.target', $window).text(response.message);
-                                setTimeout(function() { $window.jqmHide() }, 1000)
+                                setTimeout(function() { $window.jqmHide() }, 1000);
+                                if (response.redirect)
+                                    window.location = response.redirect;
                             }
                             else {
                                 $('.error', $window).remove();