JSFiddle - React, Tailwind, and code Playground
HTML
<span id="asyn">ASynchronous</span>
<br />
<span id="syn">Synchronous</span>
JavaScript
function launch(asynchronous){
var xhr;
try { xhr = new ActiveXObject('Msxml2.XMLHTTP'); }
catch (e)
{
try { xhr = new ActiveXObject('Microsoft.XMLHTTP'); }
catch (e2)
{
try { xhr = new XMLHttpRequest(); }
catch (e3) { xhr = false; }
}
}
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
if(xhr.status == 200)
window.open('http://jquery.com');
}
};
xhr.open( "GET", document.location.href, asynchronous);
xhr.send(null);
}
$('#syn').click(function(){
launch(true);
});
$('#asyn').click(function(){
launch(false);
});