Catch $.getJSON error

Posted by Switz on Stack Overflow See other posts from Stack Overflow or by Switz
Published on 2011-01-10T10:50:52Z Indexed on 2011/01/10 10:53 UTC
Read the original article Hit count: 302

Filed under:
|
|
|

I've been trying to figure this out for hours. I have a DYNAMIC youtube search, which I use Youtube's JSON api for. It works usually, but there are times that it won't find anything. Is there a way to figure out if it finds nothing, and then end the function because otherwise it stops the entire code. I tried jsonp, but that didn't seem to be correct. Somewhere I read that error catching is built into the newest jQuery getJSON, but I couldn't find it.

The code is really tedious so I'd rather not post it unless it comes to that. I'd appreciate any help! Thanks guys.

error showing that json didn't return anything

jquery-1.4.4.min.js:32 TypeError: Result of expression 'j' [undefined] is not an object.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery