web/data/cubicweb.ajax.js
changeset 6555 f8b36b1e98bf
parent 6448 8590d82e9b1b
child 6565 e89de028d004
equal deleted inserted replaced
6554:d60250252fc6 6555:f8b36b1e98bf
   320                 deferred.error(xhr, status, null);
   320                 deferred.error(xhr, status, null);
   321             }
   321             }
   322         });
   322         });
   323         return deferred;
   323         return deferred;
   324     } else {
   324     } else {
   325         var result = jQuery.ajax({
   325         var result;
       
   326         // jQuery.ajax returns the XHR object, even for synchronous requests,
       
   327         // but in that case, the success callback will be called before
       
   328         // jQuery.ajax returns. The first argument of the callback will be
       
   329         // the server result, interpreted by jQuery according to the reponse's
       
   330         // content-type (i.e. json or xml)
       
   331         jQuery.ajax({
   326             url: url,
   332             url: url,
   327             type: (reqtype || 'GET').toUpperCase(),
   333             type: (reqtype || 'GET').toUpperCase(),
   328             data: form,
   334             data: form,
   329             traditional: true,
   335             traditional: true,
   330             async: false
   336             async: false,
       
   337             success: function(res) {
       
   338                 result = res;
       
   339             }
   331         });
   340         });
   332         return result;
   341         return result;
   333     }
   342     }
   334 }
   343 }
   335 
   344