-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..

Liam
  • 27,717
  • 28
  • 128
  • 190
PaulJames
  • 95
  • 1
  • 8
  • 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](/help/how-to-ask) _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. – Mike 'Pomax' Kamermans Aug 14 '19 at 15:08

1 Answers1

-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." );
});
Ahmed Nuaman
  • 12,662
  • 15
  • 55
  • 87