uses jquery for jsonp

bzr revid: nicolas.vanhoren@openerp.com-20130117161233-zyd6z50nbljzh603
This commit is contained in:
niv-openerp
2013-01-17 17:12:33 +01:00
parent f69e2c45f6
commit 2863b43c7e
@@ -7,14 +7,12 @@ define(["nova", "jquery", "underscore", "oeclient", "require"], function(nova, $
var connection;
livesupport.main = function(server_url, db, login, password) {
var def = $.Deferred();
var tmp = window.oe_livesupport_templates_callback;
window.oe_livesupport_templates_callback = _.bind(def.resolve, def);
setTimeout(_.bind(def.reject, def), 5000);
var src = $('<script src="' + require.toUrl("./livesupport_templates.js") + '"></script>').appendTo($("head"));
def.then(function(content) {
window.oe_livesupport_templates_callback = tmp;
src.remove();
$.ajax({
url: require.toUrl("./livesupport_templates.js"),
jsonpCallback: "oe_livesupport_templates_callback",
dataType: "jsonp",
cache: true,
}).then(function(content) {
return templateEngine.loadFileContent(content);
}).then(function() {
connection = new oeclient.Connection(new oeclient.JsonpRPCConnector(server_url), db, login, password);