diff --git a/javascript/AssetTableField.js b/javascript/AssetTableField.js index 4966ea6c..0c0a7808 100644 --- a/javascript/AssetTableField.js +++ b/javascript/AssetTableField.js @@ -127,6 +127,7 @@ AssetTableField.prototype = { var img = Event.element(e); var link = Event.findElement(e,"a"); var row = Event.findElement(e,"tr"); + var self = this; var linkCount = row.getElementsByClassName('linkCount')[0]; if(linkCount) linkCount = linkCount.innerHTML; @@ -139,30 +140,28 @@ AssetTableField.prototype = { if(confirmed) { img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work - new Ajax.Request( - link.getAttribute("href"), - { - method: 'post', - postBody: 'forceajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''), - onComplete: function(){ - Effect.Fade( - row, - { - afterFinish: function(obj) { - // remove row from DOM - obj.element.parentNode.removeChild(obj.element); - // recalculate summary if needed (assumes that TableListField.js is present) - // TODO Proper inheritance - if(this._summarise) this._summarise(); - // custom callback - if(this.callback_deleteRecord) this.callback_deleteRecord(e); - }.bind(this) + jQuery.ajax({ + 'url': link.getAttribute("href"), + 'method': 'post', + 'data': {'forceajax': 1, 'SecurityID': $('SecurityID') ? $('SecurityID').value : null}, + 'success': function(){ + Effect.Fade( + row, + { + afterFinish: function(obj) { + // remove row from DOM + obj.element.parentNode.removeChild(obj.element); + // recalculate summary if needed (assumes that TableListField.js is present) + // TODO Proper inheritance + if(self._summarise) self._summarise(); + // custom callback + if(self.callback_deleteRecord) self.callback_deleteRecord(e); } - ); - }.bind(this), - onFailure: this.ajaxErrorHandler - } - ); + } + ); + }, + 'error': this.ajaxErrorHandler + }); } Event.stop(e); diff --git a/javascript/CommentTableField.js b/javascript/CommentTableField.js index 8eb9ba4e..3a5215cf 100644 --- a/javascript/CommentTableField.js +++ b/javascript/CommentTableField.js @@ -55,17 +55,15 @@ CommentTableField.prototype = { var row = Event.findElement(e,"tr"); img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work in Firefox1.5+ - new Ajax.Request( - link.getAttribute("href"), - { - method: 'post', - postBody: 'forceajax=1', - onComplete: function(){ - Effect.Fade(row); - }.bind(this), - onFailure: function(response) {errorMessage('Server Error', response);} - } - ); + jQuery.ajax({ + 'url': link.getAttribute("href") + 'method': 'post', + 'data': 'forceajax=1', + 'success': function(){ + Effect.Fade(row); + }, + 'error': function(response) {errorMessage('Server Error', response);} + }); Event.stop(e); }, diff --git a/javascript/MemberTableField.js b/javascript/MemberTableField.js index ed7805bd..fcb091d5 100755 --- a/javascript/MemberTableField.js +++ b/javascript/MemberTableField.js @@ -341,13 +341,15 @@ function ajaxSubmitFieldSet(href, fieldSet, extraData) { data += '&'+extraData; } // Send request - new Ajax.Request(href, { - method : 'post', postBody : data, - onSuccess : function(response) { + jQuery.ajax({ + 'url': href, + 'method' : 'post', + 'data' : data, + 'success' : function(response) { //alert(response.responseText); Ajax.Evaluator(response); }, - onFailure : function(response) { + 'error' : function(response) { alert(response.responseText); //errorMessage('Error: ', response); } diff --git a/javascript/WidgetAreaEditor.js b/javascript/WidgetAreaEditor.js index f18394c9..c37b06b3 100644 --- a/javascript/WidgetAreaEditor.js +++ b/javascript/WidgetAreaEditor.js @@ -122,12 +122,14 @@ WidgetAreaEditorClass.prototype = { this.name = holder; - new Ajax.Request('Widget_Controller/EditableSegment/' + className, { - onSuccess : $('usedWidgets-'+holder).parentNode.parentNode.insertWidgetEditor.bind(this) + jQuery.ajax({ + 'url': 'Widget_Controller/EditableSegment/' + className, + 'success' : $('usedWidgets-'+holder).parentNode.parentNode.insertWidgetEditor.bind(this) }); }, updateWidgets: function() { + var self = this; // Gotta get the name of the current dohickey based off the ID this.name = this.element.id.split('-').pop(); @@ -149,8 +151,11 @@ WidgetAreaEditorClass.prototype = { var wIdArray = widget.id.split('-'); wIdArray.pop(); - new Ajax.Request('Widget_Controller/EditableSegment/' + wIdArray.join('-'), { - onSuccess : $('usedWidgets-'+this.name).parentNode.parentNode.insertWidgetEditor.bind(this) + jQuery.ajax({ + 'url': 'Widget_Controller/EditableSegment/' + wIdArray.join('-'), + 'success' : function() { + $('usedWidgets-'+self.name).parentNode.parentNode.insertWidgetEditor(); + } }); } }