function fiatSelector(cur,sym){ document.getElementById('ajaxloader').style.display='block'; //blocks screen var ajaxJquery = window.localStorage.getItem("ajaxJquery"); var jqueryVersion = window.localStorage.getItem("jqueryVersion"); var currencyApi=document.getElementById('currencyApi').value; // AJAX CALL $.ajax({ type:"post", url:"currency.php", datatype:"json", data: {currency: cur, symbol: sym, ajaxJquery: ajaxJquery, jqueryVersion: jqueryVersion, currencyApi:currencyApi}, success:function(respnx) { validator = JSON.parse(respnx); console.log(validator); if(validator['outcome']=="success"){ window.location.href="" return; } if(validator['outcome']=="test"){ console.log(validator['msg']); return; } if(validator['outcome']=="nohost"){ window.location.href="/"; return; } if(validator['outcome']!="success"){ document.getElementById('ajaxloader').style.display='none'; //opens screen document.getElementById('errorBox').style.display='none'; document.getElementById('errorBox').innerHTML=""; return; } }, error: function(badx) { document.getElementById('errorBox').style.display='block'; document.getElementById('errorBox').innerHTML=""; document.getElementById('ajaxloader').style.display='none'; } }); }