Checking if a remote file exists once detection is realised.

Checking if a remote file exists once detection is realised.

Hi, I have a function that detects internet connection by returning true or false.

Using:

status=checkConnection();

then returning either True or False from the function.

Now if that statement is returned as True so I now know that I have a connection I then want to do something similar to detect the existence of  a remote file.

So the function would be something like.

file_exist=lookForFile();

function lookForFile(){

      Ajax call to look for file.  If it exists return True otherwise False.
     
}

The value of file_exist would then be one of the above.

Many thanks,
Lammie.