AJAX (Asyncronous JavaScript and XML)
let xml = new XMLHttpRequest();
xml.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
document.getElemntById("demo").innerHTML = this.responseText;
}
xml.open("GET","ajax_info.txt",true);
xml.send();
}
To make an ajax call using jQuery, we can write $.ajax({ data: $(document.forms[0]).serialize(), url: "http://www.w3schools.com", method: "GET" }). success(function(response) { $("#result").html(response); }). error(function(error) { $("#result").html(error); });
Comments
Post a Comment