AJAX-JS

by pw_we1

HTML

<button id="req">GET</button>
<p id="response">

</p>

JavaScript

$("#req").click(function(){
  $("#response").html("...");
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200)
      $("#response").html(this.responseText);
  };
  xhttp.open("GET", "http://api.fixer.io/latest", true);
  xhttp.send();
})