0

How to use open data tables with jquery url string

Hello guys,

Okay I am going off a tut from nettuts plus where the author uses Cross Domain AJAX Request with YQL and jQuery. The tut can be seen here: YQL and Jquery TUT

So in this example the author write a yql query from a url that is being set on the html page and it looks like this:
CODE
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';


In order for me to get what I want from whatever page I choose I need to be able to select a div with the ID of main-content. So when I use the console I see the query as:
CODE
use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="www.holylandmoments.org/devotionals/the-sabbath-experience" and css="#main-content p"


My problem is I don't know how I can add it to this authors example. I need to reference the open data table to be able to select this element.

So if someone can help me out I would appreciate that.

Thanks!

by
3 Replies
  • Hi Mattew!

    Just tested your query in the console and works great, so I guess that now is just a matter on how to have running the cross domain request.

    For that I recommend you the following link:

    http://ajaxian.com/archives/using-yql-as-a...oss-domain-ajax

    Cheers,
    Francisco.

    QUOTE (Matthew @ Oct 8 2010, 08:35 AM) <{POST_SNAPBACK}>
    Hello guys,

    Okay I am going off a tut from nettuts plus where the author uses Cross Domain AJAX Request with YQL and jQuery. The tut can be seen here: YQL and Jquery TUT

    So in this example the author write a yql query from a url that is being set on the html page and it looks like this:
    CODE
    var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';


    In order for me to get what I want from whatever page I choose I need to be able to select a div with the ID of main-content. So when I use the console I see the query as:
    CODE
    use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="www.holylandmoments.org/devotionals/the-sabbath-experience" and css="#main-content p"


    My problem is I don't know how I can add it to this authors example. I need to reference the open data table to be able to select this element.

    So if someone can help me out I would appreciate that.

    Thanks!
    0
  • @Fransico,

    Thanks for the reply... the problem is I don't know what the syntax would look like. i'm trying to include into the query string the USE, AS AND statements and don't know how to write that.

    QUOTE (arcturus @ Oct 8 2010, 08:45 AM) <{POST_SNAPBACK}>
    Hi Mattew!

    Just tested your query in the console and works great, so I guess that now is just a matter on how to have running the cross domain request.

    For that I recommend you the following link:

    http://ajaxian.com/archives/using-yql-as-a...oss-domain-ajax

    Cheers,
    Francisco.
    0
  • Hi Mattew,

    I don't get your point at all, you mean that you want to use a table definition and don't know how to use the 'use' statement in conjunction with table?
    If is that your question you can do something like:

    CODE
    user <mytablelocation> as mytable;select * from mytable


    Of course remember to enconde the query :DThanks for the reply... the problem is I don't know what the syntax would look like. i'm trying to include into the query string the USE, AS AND statements and don't know how to write that.
    0

Recent Posts

in YQL