function getImage() { tfTextTxt = document.getElementById('tfText').value; tfSizeTxt = document.getElementById('tfSize').value; if(tfTextTxt == "" || tfSizeTxt == ""){ alert("Prosz� wype�ni� wszystkie pola."); return; } params="?text=" + tfTextTxt + "&size=" + tfSizeTxt; url = "http://localhost/dane.php" + params; url = encodeURI(url); var btnWykonaj = document.getElementById('btnWykonaj'); btnWykonaj.disabled = true; startGETRequest(url, onComplete, onEnd); } function onComplete(text, xml) { if(text.substr(0, 5) == 'error'){ arr = text.split("\n"); if(arr.length == 2){ if(arr[0] == 'error') alert(arr[1]); else alert("Nieprawid�owa odpowied� serwera."); } } else{ var div = document.getElementById('dataDiv'); str = "<img src='image.php?name=" + text + "' alt=''>"; div.innerHTML = str; } } function onEnd() { var btnWykonaj = document.getElementById('btnWykonaj'); btnWykonaj.disabled = false; }
marcinmika