var JQueryAgent = function() { this._init(); } JQueryAgent.prototype = { _init: function() { }, _do_call: function(sync, args) { var remote_function = args[0]; var callback = null; var params = new Array(); for (var i = 1; i < args.length; i++) { if (typeof(args[i]) == 'function') { callback = args[i]; } else { params.push(args[i]); } } jQuery.ajax({ url: "/type_bien/24/professionnels.html?language=en&&nb_rows_per_page=60", async: !sync, type: "POST", data: {jquery_aa_afunc: "call", remote_function: remote_function, params: params}, success: function(cb, resp) { if (cb) { var res; try { res = jQuery.parseJSON(resp); if (res === false) { res = resp; } } catch (e) { res = resp; } cb(res); } }.bind(null, callback) }); }, call: function() { this._do_call(false, arguments); }, sync_call: function() { this._do_call(true, arguments); } } var jquery_agent = new JQueryAgent(); if (typeof(jquery_agent) == 'undefined') jquery_agent = jquery_agent;