web/data/cubicweb.ajax.js
changeset 6448 8590d82e9b1b
parent 6215 759cf097f5aa
child 6555 f8b36b1e98bf
--- a/web/data/cubicweb.ajax.js	Mon Oct 11 17:46:22 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Mon Oct 11 19:12:59 2010 +0200
@@ -188,7 +188,7 @@
     _loadDynamicFragments(node);
     // XXX [3.7] jQuery.one is now used instead jQuery.bind,
     // jquery.treeview.js can be unpatched accordingly.
-    jQuery(CubicWeb).trigger('server-response', [true, node]);
+    jQuery(cw).trigger('server-response', [true, node]);
     jQuery(node).trigger('server-response', [true, node]);
 }
 
@@ -296,6 +296,7 @@
             url: url,
             type: (reqtype || 'GET').toUpperCase(),
             data: form,
+            traditional: true,
             async: true,
 
             beforeSend: function(xhr) {
@@ -303,9 +304,6 @@
             },
 
             success: function(data, status) {
-                if (deferred._req.getResponseHeader("content-type") == 'application/json') {
-                    data = cw.evalJSON(data);
-                }
                 deferred.success(data);
             },
 
@@ -328,14 +326,9 @@
             url: url,
             type: (reqtype || 'GET').toUpperCase(),
             data: form,
+            traditional: true,
             async: false
         });
-        // check result.responseText instead of result to avoid error encountered with IE
-        if (result.responseText) {
-            // XXX no good reason to force json here, 
-            // it should depends on request content-type
-            result = cw.evalJSON(result.responseText);
-        }
         return result;
     }
 }
@@ -639,14 +632,15 @@
     function(fname /* ... */) {
         setProgressCursor();
         var props = {
-            'fname': fname,
-            'pageid': pageid,
-            'arg': $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON)
+            fname: fname,
+            pageid: pageid,
+            arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON)
         };
         var result = jQuery.ajax({
             url: JSON_BASE_URL,
             data: props,
-            async: false
+            async: false,
+            traditional: true
         }).responseText;
         if (result) {
             result = cw.evalJSON(result);
@@ -661,9 +655,9 @@
     function(fname /* ... */) {
         setProgressCursor();
         var props = {
-            'fname': fname,
-            'pageid': pageid,
-            'arg': $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON)
+            fname: fname,
+            pageid: pageid,
+            arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON)
         };
         // XXX we should inline the content of loadRemote here
         var deferred = loadRemote(JSON_BASE_URL, props, 'POST');