MCPcopy Create free account
hub / github.com/apache/cloudstack / jsonpReq

Function jsonpReq

tools/ngui/static/js/lib/angular.js:9338–9360  ·  view source on GitHub ↗
(url, done)

Source from the content-addressed store, hash-verified

9336 };
9337
9338 function jsonpReq(url, done) {
9339 // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.:
9340 // - fetches local scripts via XHR and evals them
9341 // - adds and immediately removes script elements from the document
9342 var script = rawDocument.createElement('script'),
9343 doneWrapper = function() {
9344 rawDocument.body.removeChild(script);
9345 if (done) done();
9346 };
9347
9348 script.type = 'text/javascript';
9349 script.src = url;
9350
9351 if (msie) {
9352 script.onreadystatechange = function() {
9353 if (/loaded|complete/.test(script.readyState)) doneWrapper();
9354 };
9355 } else {
9356 script.onload = script.onerror = doneWrapper;
9357 }
9358
9359 rawDocument.body.appendChild(script);
9360 }
9361}
9362
9363/**

Callers 1

createHttpBackendFunction · 0.85

Calls 2

doneWrapperFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected