No al cierre de webs
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 /**2  * Description: Manage ajax connections with a queue model.3  * Author: gerardooscarjt@gmail.com4  * Date: 2013/31/015  * Typical use:6 7 var ajax = new Ajax();8 ajax.setUrl('http://example.com/path');9 ajax.setMethod('post');10 ajax.setData({'name':'a','age':'22'};11 ajax.callback.done = function(xhr) {12  // ...13 };14 ajax.callback.error = function(xhr) {15  // ...16 };17 ajax.send();18 19 */20 var Ajax = function() {21  22  Ajax.prototype.requests.push(this);23  24  this._id = Ajax.prototype.id_generator;25  Ajax.prototype.id_generator++;26  27  28 }29 30 Ajax.prototype.requests = [];31 Ajax.prototype.queue = [];32 Ajax.prototype.id_generator = 0;33 34 window.addEventListener('load', function(){35  test1(); 36 }, true);37 38 39 /**40  * Launch 10 ajax calls41 */42 function test1() {43  var ajax = new Ajax();44  ajax.url = 'http://www.treeweb.es/request';45  ajax.callback.done = function(xhr){46  logger.log('');47  };48  ajax.send();49  50 }51 52 53 54 55 56 


Este ShareCode tiene versiones:
  1. God Ajax ... (31/01/2013)
  2. God Ajax ... (24/04/2013)
  3. God Ajax ... (24/04/2013)
  4. God Ajax ... (24/04/2013)
  5. God Ajax ... (24/04/2013)
  6. God Ajax ... (24/04/2013)
Enlace
El enlace para compartir es: