var items = { name: 'form_name', addr: 'form_addr', subj: 'form_subj', text: 'form_text', }; var server = getServer(); var xhrSend = new XMLHttpRequest(); xhrSend.onreadystatechange = function() { if (xhrSend.readyState == XMLHttpRequest.DONE) { console.log(xhrSend); } }; // Returns the server's base URI based on the user's script tag // return: the SMAM server's base URI function getServer() { var scripts = document.getElementsByTagName('script'); // Parsing all the