diff --git a/scripts/JSRootCore.js b/scripts/JSRootCore.js index 9e02710d0..5d09339da 100644 --- a/scripts/JSRootCore.js +++ b/scripts/JSRootCore.js @@ -153,7 +153,7 @@ return dflt; } - JSROOT.NewHttpRequest = function(url, kind, callback) { + JSROOT.NewHttpRequest = function(url, kind, user_call_back) { // Create asynchronous XMLHttpRequest object. // One should call req.send() to submit request // kind of the request can be: @@ -164,6 +164,11 @@ // "head" - returns request itself, uses "HEAD" method // Result will be returned to the callback functions // If failed, request returns null + + function callback(res) { + if (typeof user_call_back == 'function') user_call_back(res); + } + var xhr = new XMLHttpRequest(); // if (typeof ActiveXObject == "function") { diff --git a/scripts/JSRootPainter.js b/scripts/JSRootPainter.js index e9ef5a477..1e26cd26f 100644 --- a/scripts/JSRootPainter.js +++ b/scripts/JSRootPainter.js @@ -7446,31 +7446,27 @@ } } - JSROOT.HierarchyPainter.prototype.OpenOnline = function(server_address, - user_callback) { - if (!server_address) - server_address = ""; + JSROOT.HierarchyPainter.prototype.OpenOnline = function(server_address, user_callback) { + if (!server_address) server_address = ""; var painter = this; - var req = JSROOT.NewHttpRequest(server_address + "h.json?compact=3", - 'object', function(result) { - painter.h = result; - if (painter.h == null) - return; + var req = JSROOT.NewHttpRequest(server_address + "h.json?compact=3", 'object', function(result) { + painter.h = result; + if (painter.h == null) return; - // mark top hierarchy as online data and - painter.h['_online'] = server_address; + // mark top hierarchy as online data and + painter.h['_online'] = server_address; - painter.AddOnlineMethods(painter.h); + painter.AddOnlineMethods(painter.h); - if (painter.h != null) - painter.RefreshHtml(true); + if (painter.h != null) + painter.RefreshHtml(true); - if (typeof user_callback == 'function') - user_callback(painter); + if (typeof user_callback == 'function') + user_callback(painter); - }); + }); req.send(null); }