- // Arrrrghhhhhhhh!!
- // I overwrote the event plugin's .load
- // this won't happen again, I hope -John
- if ( a && a.constructor == Function )
- return this.bind("load", a);
-
- var t = "GET";
- if ( o && o.constructor == Function ) {
- f = o; o = null;
- }
- if (o != null) {
- o = $.param(o);
- t = "POST";
- }
- var self = this;
- $.xml(t,a,o,function(h){
- var h = h.responseText;
- self.html(h).find("script").each(function(){
- try {
- eval( this.text || this.textContent || this.innerHTML );
- } catch(e){}
- });
- if(f)f(h);
- });
- return this;
+ // Arrrrghhhhhhhh!!
+ // I overwrote the event plugin's .load
+ // this won't happen again, I hope -John
+ if ( a && a.constructor == Function ) {
+ return this.bind("load", a);
+ }
+
+ var t = "GET";
+ if ( o && o.constructor == Function ) {
+ f = o;
+ o = null;
+ }
+ if (o !== null) {
+ o = $.param(o);
+ t = "POST";
+ }
+ var self = this;
+ $.xml(t,a,o,function(h){
+ h = h.responseText;
+ self.html(h).find("script").each(function(){
+ try {
+ $.eval( this.text || this.textContent || this.innerHTML );
+ } catch(e){}
+ });
+ if(f){f(h);}
+ });
+ return this;
+};
+
+/**
+ * function: $.fn.formValues
+ * usage: $('#frmLogin').formValues()
+ * docs: Gets the form values and creates a key=>value array of the found values (only for ENABLED elements!)
+ */
+$.fn.formValues = function() {
+ var a = [];
+ this.find("input[@type='submit'],input[@type='hidden'],textarea,input[@checked],input[@type='password'],input[@type='text'],option[@selected]").filter(":enabled").each(function() {
+ var o = {};
+ o.name = this.name || this.id || this.parentNode.name || this.parentNode.id;
+ o.value = this.value;
+ a.push(o);
+ });
+ return a;
+};
+
+/**
+ * function: $.update
+ * usage: $.update('someJQueryObject', 'someurl', 'array');
+ * docs: Mimics the ajaxUpdater from prototype. Posts the key=>value array to the url and
+ * puts the results from that call in the jQuery object specified.
+ * --> If you set the blnNoEval to true, the script tags are NOT evaluated.
+ */
+$.update = function(objElement, strURL, arrValues, fncCallback) {
+ $.post(strURL, arrValues, function(strHTML) {
+ //
+ // Update the element with the new HTML
+ objElement.html(strHTML);
+
+ //
+ // Evaluate the scripts
+ objElement.html(strHTML).find("script").each(function(){
+ try { $.eval( this.text || this.textContent || this.innerHTML ); } catch(e){}
+ });
+
+ //
+ // Callback handler
+ if (fncCallback) { fncCallback(); }
+ });