0

I need to check if a file on a remote server exists of not. I don't have control over the remote server. The file that my javascript code is trying to check its existence can be downloaded or viewed by anyone in any web browser by typing file location on the web browser's address bar like this sample image file . I tried Ajax but always showing error.

EDIT : Remote server is on the different domain.

        $.ajax({
            url: 'http://public.url/sample.wav',
            type: 'HEAD',
            //dataType: 'jsonp',
            //crossDomain:true,
            error: function () {
                $("#soundFile").attr("src", "Images/error.png");                        
            },
            success: function () {
                $("#soundFile").attr("src", "Images/check.png");
            }
        });
Community
  • 1
  • 1
Seehyung Lee
  • 590
  • 1
  • 15
  • 32

0 Answers0