public
Created

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
function xdomainajax() {
var win;
if (document.location == "otcsandbox.com") {
var content = "<html><body><scr"+"ipt>document.domain='otcsandbox.com';</scr"+"ipt><scr"+"ipt src='http://wheretogetjqueryfrom.com/jquery.js'></scr"+"ipt></body></html>";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
win = iframe.contentDocument ? iframe : iframe.contentWindow ? iframe.contentWindow : iframe;
var doc = iframe.contentDocument ? iframe.contentDocument ? iframe.contentWindow ? iframe.contentWindow.document ? win.document;
 
doc.open();
doc.writeln(content);
doc.close();
}
else {
win = window;
}
win.jQuery.ajax(....);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.