//Change the text of a <div> element using an AJAX //request://using JQuery
$("button").click(function(){
$.ajax({url: "demo_test.txt", success: function(result){
$("#div1").html(result);
}});
});
//To send a request to a server, we use the open() //and send() methods of the XMLHttpRequest object:// Javascript
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
//example below<html><body><h1>The XMLHttpRequest Object</h1><button type="button" onclick="loadDoc()">Request data</button><p id="demo"></p><script>functionloadDoc() {
var xhttp =newXMLHttpRequest();
xhttp.onreadystatechange =function() {
if (this.readyState ==4&&this.status ==200) {
document.getElementById("demo").innerHTML =this.responseText;
}
};
xhttp.open("GET", "demo_get.asp", true);
xhttp.send();
}
</script></body></html>
Posted by: Guest
on January-17-2020
2
ajax open a request
<script>functionloadDoc() {
var xhttp =newXMLHttpRequest();
//looking for a change or state , like a request or get.
xhttp.onreadystatechange =function() {
//if equal to 4 means that its ready.// if equal to 200 indicates that the request has succeeded.if (this.readyState ==4&&this.status ==200) {
document.getElementById("demo").innerHTML =this.responseText;
}
};
//GET method for gettin the data // the file you are requesting
xhttp.open("GET", "TheFileYouWant.html", true);
//sending the request
xhttp.send();
}
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems
resetting your password contact us
Check Your Email and Click on the link sent to your email