From 939b4beb1b2e17706a8a5a41c799b4754d1804d6 Mon Sep 17 00:00:00 2001 From: AWolf81 Date: Sat, 14 Mar 2015 22:30:47 +0100 Subject: [PATCH] Changed query and added tip for environment table search.news seems to be dropped. Added tip with environment to access community tables and added link to a demo jsfiddle. Added blank line after code block & removed blank lines at the end removed link to jsfiddle. Not really needed. --- page/ajax/working-with-jsonp.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/page/ajax/working-with-jsonp.md b/page/ajax/working-with-jsonp.md index 765be086..083be2b8 100644 --- a/page/ajax/working-with-jsonp.md +++ b/page/ajax/working-with-jsonp.md @@ -20,7 +20,7 @@ $.ajax({ // Tell YQL what we want and that we want JSON data: { - q: "select title,abstract,url from search.news where query=\"cat\"", + q: "select * from search.ec (1, 10) WHERE keyword='New York'", format: "json" }, @@ -31,4 +31,6 @@ $.ajax({ }); ``` +If you'd like to access community tables you have to add `env: "http://datatables.org/alltables.env"` to the data object otherwise you would get an error message with `No definition found for Table`. + jQuery handles all the complex aspects of JSONP behind-the-scenes — all we have to do is tell jQuery the name of the JSONP callback parameter specified by YQL ("callback" in this case), and otherwise the whole process looks and feels like a normal Ajax request.