Selecting href using yql

You must Login before you can answer or comment on any questions.

Hi, I want to pick the url using yql query and this is result of my query <a href="job.php?JOBID=5#job-table"/> <a href="job.php?JOBID=3#job-table"/> <a href="job.php?JOBID=2#job-table"/> The query is as select href from html where url="http://afghanskills.com/all-jobs.php" and xpath="//tbody/tr/td/a" i am showing the result in alert but nothing is shown the code is as follows Titanium.Yahoo.yql('select href from html where url="http://afghanskills.com/all-jobs.php" and xpath="//tbody/tr/td/a"',function(e){ var url=new Array(); var results = e.data.a;

for (var i = 0; i &lt; results.length; i++) {

    var rss = results[i];
    url[i] = rss.content;
    alert(url[i]);
}});

1 Answer

Accepted Answer

You are trying to get the wrong data:

var results = e.data.a;
 
for (var i = 0; i < results.length; i++) {
    alert(results[i].href);
}
e looks like this:
{
    data =     {
        a =         (
                        {
                href = "job.php?JOBID=5#job-table";
            },
                        {
                href = "job.php?JOBID=3#job-table";
            },
                        {
                href = "job.php?JOBID=2#job-table";
            }
        );
    };
    source = "[object YahooModule]";
    success = 1;
    type = yql;
}

Your Answer

Think you can help? Login to answer this question!