Rahul Rahul - 9 months ago 51
Ajax Question

how do I get the reponse text from ajax code

I have one url like "".when i run this url i am getting "Hi welcome".how to write code in AJAX to get "Hi welcome"


You should've searched it a bit more. In this Link you have the easy GET method, that will look like this:

function loadDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
     document.getElementById("demo").innerHTML = xhttp.responseText;
  xhttp.open("GET", "", true);