- Ana Sayfa
- >
- Javascript
- >
- XMLHttpRequest İle Sayfa Yenilemeden Get...
<!DOCTYPE html>
<html>
<body>
<h1>XMLHttpRequest Nesnesi İle Get Veya Post İle Veri Almak</h1>
<button type=”button” onclick=”veriyolla()”>Veri Al</button>
<p id=”gelenveri”></p>
<script>
function veriyolla() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(“gelenveri”).innerHTML = this.responseText;
}
};
xhttp.open(“POST”, “veriyialacakolan.php”, true);
xhttp.send();
}
</script>
</body>
</html>