How to use YQL in JavaScript to retrieve web results

I have been trying the code given in How to use YQL to retrieve web results?

but it is not working.

Please suggest me something else or rectify that code.

I am just calling a function on page_load

<body onload = "load_content();">

In the load_content() method, I have to get the feed of other web site and display it on my HTML page.

Load_Content method

     var query = "select * from html where url=''";

    // Define your callback:
    var callback = function(data) {
    console.log("DATA : " + data);

    // Instantiate with the query:
    var firstFeedItem = new YQLQuery(query, callback);

    // If you're ready then go:
    console.log("FEED : " + firstFeedItem.fetch()); // Go!!

Function YQLQuery

    function YQLQuery(query, callback) 
        this.query = query;
        this.callback = callback || function(){};
        this.fetch = function() {

        if (!this.query || !this.callback) {
            throw new Error('YQLQuery.fetch(): Parameters may be undefined');

        var scriptEl = document.createElement('script'),
            uid = 'yql' + +new Date(),
            encodedQuery = encodeURIComponent(this.query.toLowerCase()),
            instance = this;

        YQLQuery[uid] = function(json) {
            delete YQLQuery[uid];

        scriptEl.src = ''
                     + encodedQuery + '&format=json&callback=YQLQuery.' + uid; 


Nothing is coming in data variable


A simple get request is an answer to this.

    }//end function(data)
 );//end getJSON

Need Your Help

<a> tag in html

javascript html jsp

I have the following code in a JSP file:

Developing a Java app that runs both on the web and as an Android app?

java android

I'm working on a game which would work both on the web, as an applet, and on the Android phone, as an app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.