Jon P

Jon P

What's the preferred method for ensuring a given video ID is valid? jQuery doesn't provide error handling for AJAX requests of type script.

Making an AJAX request to the video seems to fire an AJAX error every time, even when the ID is valid.

Any pointers?

Brad Dougherty

Brad Dougherty Staff

If you request the video info with the Simple API, it should return a 404 if the video doesn't exist.

Jon P

Jon P

It does indeed return a 404 if the video doesn't exist, but I don't know how to check for that 404 HTTP status in javascript when loading a remote URL.

If the video ID is invalid, a script tag is still added to my document when using the jQuery $.ajax method with type 'script'.

Richie Mortimer

Richie Mortimer

Hi,

Okay so its turns out JSONP doesn't do error handling either, so effectively the ability to check to see if a video exists via javascript with the api, is, well, useless.

Youtube kicks back a response telling us its a 404, so we can check in the onSuccess method. Could we have this in vimeo please.

Cheers

This conversation is missing your voice. Please join Vimeo or log in.