web/data/cubicweb.ajax.js
branchtls-sprint
changeset 1263 01152fffd593
parent 985 6a25c58a1c23
parent 1077 fe26a0cda180
child 1320 c85f4d8eff8b
--- a/web/data/cubicweb.ajax.js	Mon Apr 06 12:37:45 2009 +0200
+++ b/web/data/cubicweb.ajax.js	Tue Apr 07 09:30:23 2009 +0200
@@ -42,6 +42,12 @@
 
 // cubicweb loadxhtml plugin to make jquery handle xhtml response
 jQuery.fn.loadxhtml = function(url, data, reqtype, mode) {
+    var ajax = null;
+    if (reqtype == 'post') {
+	ajax = jQuery.post;
+    } else {
+	ajax = jQuery.get;
+    }
     if (this.size() > 1) {
 	log('loadxhtml was called with more than one element');
     }
@@ -52,8 +58,9 @@
 	callback = data.callback;
 	delete data.callback;
     }
-    var deferred = loadJSON(url, data, reqtype);
-    deferred.addCallback(function(response, req) {
+    var node = this.get(0); // only consider the first element
+    ajax = jQuery.post;
+    ajax(url, data, function(response) {
 	var domnode = getDomFromResponse(response);
 	if (mode == 'swap') {
 	    var origId = node.id;