Dat One Lefty 0 Newbie Poster

I currently have the code

function httpGet(theUrl)
{

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
return this.responseText;

  }
};
xhttp.open("GET", theUrl, true);
xhttp.send();
}

when i replace return with code to set a div, it replaces, but when I try to return the data, it returns undefined.

How can I make the data return properly?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.