var NDIV = document.createElement("div"); NDIV.style.position = "absolute"; NDIV.style.right = "3px"; NDIV.style.bottom = "1px"; NDIV.style.width = "50%"; //NDIV.style.height = "80%"; //NDIV.style.overflowY = "hidden"; NDIV.id = "NOTIFIER"; document.body.appendChild(NDIV); function NotiFi(){ if(arguments[0]=="OK") var NOTIFIER='
'+arguments[1]+' '+arguments[2]+'
'; else var NOTIFIER='
'+arguments[1]+' '+arguments[2]+'
'; var NOTIFIERDiv = document.getElementById("NOTIFIER"); NOTIFIERDiv.innerHTML += NOTIFIER; } //NotiFi("OK","Error","Some error info..."); function SC(cname,cvalue,exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires=" + d.toGMTString(); document.cookie = cname+"="+cvalue+"; "+expires; } function GC(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i"; } document.getElementById("demo").innerHTML = text;//alert(f); } function fetch_form_data (f) { var fd = document.getElementById(f); formData = new FormData(fd);//console.log(formData); var xhr = new XMLHttpRequest(); xhr.open('POST', '/exe/?FORM='+f, true); xhr.upload.onprogress = function(e) { if (e.lengthComputable) { var i;for (i = 0; i < fd.length ;i++) fd.elements[i].disabled = true; var percentComplete = (e.loaded / e.total) * 100; console.log(percentComplete + '% uploaded'); } }; xhr.onload = function() { if (this.status == 200) { console.log(this.response); /*var resp = JSON.parse(this.response); console.log('Server got:', resp); var image = document.createElement('img'); image.src = resp.dataUrl; document.body.appendChild(image);*/ resp = JSON.parse(this.response);//console.log(resp['NotiFi']); if(resp['NotiFi'] && resp['NotiFi'].length>=2) NotiFi(resp['NotiFi'],resp['NotiFi_m'],resp['NotiFi_d']); var i;for (i = 0; i < fd.length ;i++) fd.elements[i].disabled = false; }; }; xhr.send(formData); }