[Jifty-commit] r4820 - jifty/branches/jquery/share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jan 11 11:04:47 EST 2008


Author: gugod
Date: Fri Jan 11 11:04:45 2008
New Revision: 4820

Modified:
   jifty/branches/jquery/share/web/static/js/jifty.js

Log:
* Replace $F() with jQuery(..).val()
* Replace one Ajax.Request with jQuery.ajax


Modified: jifty/branches/jquery/share/web/static/js/jifty.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/jifty.js	(original)
+++ jifty/branches/jquery/share/web/static/js/jifty.js	Fri Jan 11 11:04:45 2008
@@ -1372,6 +1372,7 @@
     this.action = Form.Element.getAction(this.field);
     this.url    = '/__jifty/autocomplete.xml';
 
+    var self = this;
     jQuery(this.field).bind("focus", function(event) {
         self.onFocus(event);
     });
@@ -1442,18 +1443,22 @@
       request['actions']['autocomplete'] = a;
       request['actions'][this.action.moniker] = this.action.data_structure();
       request['actions'][this.action.moniker]['active']  = 0;
-
-      var options = { postBody: JSON.stringify(request),
-                      onComplete: this.onComplete.bind(this),
-                      requestHeaders: ['Content-Type', 'text/x-json']
-      };
-
-      new Ajax.Request(this.url,
-                       options
-                       );
-  }
+      
+      var self = this;
+      jQuery.ajax({
+          url: this.url,
+          type: 'post',
+          data: JSON.stringify(request),
+          complete: function(xhr, status) {
+              self.onComplete(xhr);
+          },
+          beforeSend: function(xhr) {
+              xhr.setRequestHeader('Content-Type', 'text/x-json');
+          }
+      });
 
 
+  }
 });
 
 Jifty.Placeholder = function() {
@@ -1579,10 +1584,10 @@
             });
         } else if ((parsed != null) && (parsed.length == 2)) {
             // Hidden default
-            hiddens[ parsed[1] ] = $F(e);
+            hiddens[ parsed[1] ] = jQuery(e).val();
         } else if (e.name.length > 0) {
             // Straight up values
-            inputs[ e.name ] = $F(e);
+            inputs[ e.name ] = jQuery(e).val();
         }
     }
 


More information about the Jifty-commit mailing list