AJAX Anketi
Aşağıdaki örnekte, sonucun yeniden yüklenmeden gösterildiği bir anket gösterilecektir.
<html>
<head>
<script>
function getVo te(int) {
if (window.XMLHtt pRequest) {
// code for IE7+, F irefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new Ac tiveXObje ct("Microsoft.XMLHTTP");
}
xmlhttp.onreadystate chan ge=function() {
if (this.readyState==4 && this.status==200) {
document.getEle mentB yId ("poll").innerHTML=this.responseText;
}
}
xmlhttp.open("GET","poll_vote .php?vote="+int,true);
xmlhttp.send();
}
</script>
</head>
<body>
<div id="poll">
<h3>Do you like PHP and AJAX so far?</h3>
<form>
Yes:
<input type="radio" na m e="vote" value="0" onclick="get Vote(this.value)">
<br>No:
<input type="radio" name="vote" value="1" onclick="getVote(t his.value)">
</form>
</div>
</body>
</html>
GetVote () işlevi aşağıdakileri yapar:
XMLHttpRequest nesnesi oluÅŸturma
Sunucu yanıtı hazır olduğunda yürütülecek işlevi oluşturun
İsteği sunucudaki bir dosyaya gönderme
URL'ye bir parametre (oylama) eklendiğine dikkat edin (evet veya hayır seçeneğinin değeriyle)
özel tuketim vergisi bu yazimiz tarhiyl... ozeltuketimvergisi 2021-02-24 07:07:34
ECE RONAY O İŞ BENDE 4. BÖLÜM Depo Ä... eceronay 2021-02-19 06:21:56
ECE RONAY O İŞ BENDE 3. BÖLÜM (İnş... eceronay 2021-02-19 06:18:15
ECE RONAY O İŞ BENDE 2. BÖLÜM (Oto Y... eceronay 2021-02-19 06:13:19
Sizlere sordum, kadınların yapamaz ded... eceronay 2021-02-19 06:07:58
1Adet : Canon EOS 250D DSLR FotoÄŸraf Ma... canon 2021-02-15 13:08:40
Karpuz isimli şarkıma oldukça yoğun ... eceronay 2020-03-22 15:30:36
AdSense için hazırlanmış web sitesi... Adsense 2020-01-18 22:00:36
iddalara gore Dr. Özgür Kartal yuva yi... doktor 2020-07-26 00:56:28
https://www.youtube.com/watch?v=zsGPzAFa... sude 2020-03-31 03:11:42
Sizler için halka ışık ürün incele... serhatyigitcetin 2020-03-09 11:52:05
Cennetin Göz yaslarindan bir kare burd... oykukizil 2020-01-26 01:46:33