try{ xmlHttp.open('GET', url, true); xmlHttp.onload = function(e) { document.getElementById('saemlink').innerHTML=xmlHttp.responseText; } xmlHttp.send(); // because of "false" above, will block until the request is done // and status is available. Not recommended, however it works for simple cases. }catch(e) {alert(e);} console.log('dioporco');