if (window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } elseif (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } xhr.open("post",url, true); xhr.onload = function (evt){ var data = JSON.parse(evt.target.responseText); // TODO AFTER console.log(data) } xhr.onerror = function () { console.log('ERROR') }; xhr.upload.onloadstart = function(){ console.log('start'); }; xhr.send(form);