[jQuery] Re: Check if remote file exists.

2008-11-05 Thread Andy Matthews

I think if you use the $.ajax method, you can implement the built in failure
method and go from there.


andy 

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Genu
Sent: Wednesday, November 05, 2008 12:54 PM
To: jQuery (English)
Subject: [jQuery] Check if remote file exists.


Is it possible to use jquery to check of remote file (url) exists or not.
For example, I have this url:

http://www.myserver.com/media/test.mp3

can I use a jquery http request to see if the url is valid or not?




[jQuery] Re: Check if remote file exists.

2008-11-05 Thread Karl Rudd

What you want is a HEAD request. See the following for details:

http://www.jibbering.com/2002/4/httprequest.html
http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro3/

Karl Rudd

On Thu, Nov 6, 2008 at 5:54 AM, Genu [EMAIL PROTECTED] wrote:

 Is it possible to use jquery to check of remote file (url) exists or
 not. For example, I have this url:

 http://www.myserver.com/media/test.mp3

 can I use a jquery http request to see if the url is valid or not?




[jQuery] Re: Check if remote file exists.

2008-11-05 Thread Jeffrey Kretz

That's pretty interesting -- I never thought of that.

So I imagine an $.ajax({url:'somefile.dat',type:'HEAD',error:do_something}) 
would be enough to check for a 404.

Nifty.
JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl 
Rudd
Sent: Wednesday, November 05, 2008 4:33 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Check if remote file exists.


What you want is a HEAD request. See the following for details:

http://www.jibbering.com/2002/4/httprequest.html
http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro3/

Karl Rudd

On Thu, Nov 6, 2008 at 5:54 AM, Genu [EMAIL PROTECTED] wrote:

 Is it possible to use jquery to check of remote file (url) exists or
 not. For example, I have this url:

 http://www.myserver.com/media/test.mp3

 can I use a jquery http request to see if the url is valid or not?