Home »
Categories » TypeScript |
What is the equivalent of file_get_contents ($ url) in JavaScript or TypeScript? |
Article Number: 54 | Rating: Unrated | Last Updated: Sun, Oct 18, 2020 at 9:13 PM
|
Use Ajax
$.ajax({
type: "GET",
url: "http://www.flalottery.com/exptkt/ff.html"
}).done(function(data){
console.log(data);
});
Or use a simple get request
$.get("http://www.flalottery.com/exptkt/ff.html", function(data) {
console.log(data);
});
Or use XHR
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.flalottery.com/exptkt/ff.html", true);
xhr.onload = function () {
console.log(xhr.responseText);
};
xhr.send();
Ref: https://stackoverflow.com/questions/47003989/what-is-the-equivalent-of-file-get-contents-url-in-javascript-or-typescript
|
Posted by: Saeed Nobakht - Sun, Oct 18, 2020 at 9:13 PM This article has been viewed 4136 times.
Filed Under: TypeScript
|
Article Rating (No Votes)
Rate this article
|
| | |
|
Attachments
There are no attachments for this article.
| Comments There are no comments for this article. Be the first to post a comment.
Add Comment
| Related Articles There are no related articles for this article. |
|