web/data/cubicweb.lazy.js
changeset 543 c0f2b6378f70
parent 522 385ce5e0b30b
child 559 7cfd3d11edc8
--- a/web/data/cubicweb.lazy.js	Fri Jan 30 16:56:21 2009 +0100
+++ b/web/data/cubicweb.lazy.js	Fri Jan 30 16:57:20 2009 +0100
@@ -1,22 +1,14 @@
 
 function load_now(eltsel, holesel) {
-  var lazydiv = jQuery(eltsel);
-  var hole = lazydiv.children(holesel);
-  if (hole.length == 0) /* the hole is already filled */
-    return;
-  var vid_eid = lazydiv.attr('cubicweb:lazyloadurl');
-  /* XXX see what could be done with jquery.loadxhtml(...)   */
-  var later = async_rawremote_exec('lazily', vid_eid);
-  later.addCallback(function(req) {
-    var div = lazydiv[0];
-    div.appendChild(getDomFromResponse(req));
-    div.removeChild(hole[0]);
-  });
-  later.addErrback(function(err) {
-    log(err);
-  });
+    var lazydiv = jQuery(eltsel);
+    var hole = lazydiv.children(holesel);
+    if (hole.length == 0) {
+	/* the hole is already filled */
+	return;
+    }
+    lazydiv.loadxhtml(lazydiv.attr('cubicweb:loadurl'));
 }
 
 function trigger_load(divid) {
-  jQuery('#lazy-' + divid).trigger('load_' + divid);
-}
\ No newline at end of file
+    jQuery('#lazy-' + divid).trigger('load_' + divid);
+}