I want to fetch data from a API link by using java script. I want to do this in only pure javascript.
Asked
Active
Viewed 120 times
-3
-
That's the way: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest – divoom12 Oct 13 '15 at 07:35
1 Answers
1
Use JavaScript function:
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", url, true);
xmlHttp.send(null);

Prabhas Nayak
- 282
- 1
- 4