Salt Javascript ile ;

var xhr = new XMLHttpRequest();
xhr.function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
alert(xhr.responseText);
}
}
xhr.open('GET', 'http://example.com', true);
xhr.send(null);


jQuery ile ;

$.ajax({
type : "POST" || "GET"
url : "xxx.php"
success : function(returnData){
console.log(returnData);
}
});