AJAX Veritabanı Örneği
Aşağıdaki örnek, bir web sayfasının AJAX ile bir veritabanından nasıl bilgi alabileceğini gösterecektir:
<html>
<head>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Joseph Swanson</option>
<option value="4">Glenn Quagmire</option>
</select>
</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>
</body>
</html>
1.kapitalist sistemin insanlara atmis ol... olacaklar 2021-01-07 22:35:42
25 kasim 2020 kamil koc istanbul. Corum ... olacaklar 2020-11-25 04:35:53
cast oyuncularin bir arada toplandigi, ... cast 2020-11-07 20:31:00
BARAN - İlaç (Official Video) Baran'Ä... baranofficial 2020-08-07 19:59:01
Vatanım Gibisin Eserimizi Kliplendirdik... bulentyigit 2020-08-02 00:09:47
iddalara gore Dr. Özgür Kartal yuva yi... doktor 2020-07-26 00:56:28
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