Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3991968
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:40:45+00:00 2026-05-20T06:40:45+00:00

I am trying to display content from a YQL Query. However, the value I

  • 0

I am trying to display content from a YQL Query. However, the value I am entering into my text field is returning a value of undefined when I submit it, thus causing the YQL query to fail.

Along with this issue, I’m not sure how to select just the titles from the data argument in the callback function for the getJSON function in this portion of my code:

//Return the JSON results of the YQL query
$.getJSON(restQuery, function(data) {
    //Display the returned results in the searchResults div
    $("#searchResults").html(data);
});

Here is the JSFiddle of my code: http://jsfiddle.net/JAS4H/30/

Thanks in advance for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:40:46+00:00Added an answer on May 20, 2026 at 6:40 am

    I’ve cleaned up your code a bit.

    $(function() {
    
        function search(term) {
            var query = 'SELECT title FROM search.web WHERE query="' + term + '"',
                url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&diagnostics=true&callback=cbfunc';
    
            $.get(url, function(data) {
                $('#searchResults').html(data);
            });
        }
    
        $('#search').live('submit', function() {
            search($('#searchInput').val());
            return false;
        });
    
    });
    

    Demo: http://jsfiddle.net/JAS4H/33/

    As you can see, the response data is not JSON – that’s why $.getJSON() does not work. For instance, if you search for “cars”, you will get this response:

    cbfunc({“query”:{“count”:10,”created”:”2011-02-21T20:40:16Z”,”lang”:”en-US”,”diagnostics”:{“publiclyCallable”:”true”,”url”:{“execution-time”:”779″,”content”:”http://boss.yahooapis.com/ysearch/web/v1/cars?format=xml&start=0&count=10″},”user-time”:”781″,”service-time”:”779″,”build-version”:”11323″},”results”:{“result”:[{“title”:”New
    & Used Cars for Sale, Auto Dealers,
    Car Reviews and Car
    …”},{“title”:”Cars
    (Movie)”},{“title”:”AutoTrader”},{“title”:”New
    Cars, Used Cars, Blue Book Values &
    Car Prices – Kelley
    …”},{“title”:”Automobile –
    Wikipedia, the free
    encyclopedia”},{“title”:”Car Allowance
    Rebate System (CARS)”},{“title”:”Used
    Cars – Used Car Prices, Used Car
    Values & Reviews
    …”},{“title”:”Edmunds.com”},{“title”:”Cars
    For Sale, Used Cars For Sale, New Cars
    For Sale …”},{“title”:”Research New
    Cars & Used Cars : Automobile Prices,
    Specs …”}]}}});

    This is JSONP I believe …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive been trying to display formatted content blocks from a xml file with no
im trying to display content of xmllistcollection in different fields in my datagrid however
I've been trying to display text using a Quartz context, but no matter what
When trying to display a byte stream from HLDS (Half-Life Dedicated Server) in a
I'm trying to display a series of titles varying from 60 characters to 160
I am trying to display a pie chart that shows sales by company. However
How would one display any add content from a dynamic aspx page? Currently I
I'm trying to get off site content and display it on my web site.
I'm trying to get content from an RSS2 feed from one of my sites
I'm trying to insert reCaptcha code into my page from jQuery, but it doesn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.