-2

I have been using

$autoComplete = file_get_contents("stackoverflow.com");

When using PHP, but I now need a Javascript equivalent. Is there one..

I need to read a txt file that is accessed via URL..

I obviously have been googling, but nothing seems to work.

Any help would be great..

1
  • If "nothing seems to work", it sounds like you actually found, and then tried, several things. That's great! But please remember to show/tell us what you tried, so we can tell whether you're actually going down the right road or whether you've completely misunderstood how JS works. Commented Aug 14, 2019 at 15:08

1 Answer 1

-3

This is what you need: https://api.jquery.com/jquery.ajax/

Something like:

$.get( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
  alert( "Load was performed." );
});
Sign up to request clarification or add additional context in comments.

4 Comments

why show jQuery when the JS Fetch API is a perfectly fine, modern bit of JS on every browser?
The appropriate thing to do here, as a 6K user, is to VTC as a duplicate here not answer
How could I access/display that jQuery - say in an alert box.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.