From 7faf0a145721e4af070e95ee06facbf40304c558 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Fri, 30 Dec 2011 19:22:54 +0400 Subject: [PATCH 1/2] two additional methods to simplify querying --- jquery.yql.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jquery.yql.js b/jquery.yql.js index 744de89..254e820 100644 --- a/jquery.yql.js +++ b/jquery.yql.js @@ -72,6 +72,16 @@ $.ajax(yqlJson); return $self.toReturn; + }, + yqlJSON: function(url, callback) { + return $.yql("SELECT * FROM json WHERE url=#{url}", {url: url}, function(data) { + callback(data.query.results.json); + }); + }, + yqlXML: function(url, callback) { + return $.yql("SELECT * FROM xml WHERE url=#{url}", {url: url}, function(data) { + callback(data.query.results); + }); } } ); From 42138297c3bf78e47c8033c55799a92b552cc12a Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Sat, 31 Dec 2011 08:32:06 +0400 Subject: [PATCH 2/2] data.query.results can be null --- jquery.yql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.yql.js b/jquery.yql.js index 254e820..a79b861 100644 --- a/jquery.yql.js +++ b/jquery.yql.js @@ -75,7 +75,7 @@ }, yqlJSON: function(url, callback) { return $.yql("SELECT * FROM json WHERE url=#{url}", {url: url}, function(data) { - callback(data.query.results.json); + callback(data.query.results && data.query.results.json); }); }, yqlXML: function(url, callback) {