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

  • Home
  • SEARCH
  • 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 4032662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:44:57+00:00 2026-05-20T11:44:57+00:00

Hi I’m just trying to do some simple AJAX stuff by retrieving search results

  • 0

Hi I’m just trying to do some simple AJAX stuff by retrieving search results from Twitter. It is bringing back the objects but I can’t seem to drill down to the object itself and get the info (such as text).

If I console.log(tweet), it lists all the objects, but the code below just says “undefined”. I’m sure I’m missing something easy.

I’ve read loads of questions/answers on here but none seem to do it. I see many have used the .getJSON() method, but using .ajax() should be ok I would have thought?

    $.ajax({
        dataType: 'jsonp',
        url: 'http://search.twitter.com/search.json?callback=?&q=twitter&rpp=5',
        success: function (data) {
            $.each(data, function(i,tweet){
                console.log(tweet.text);
                //$('#twitter ul').append('<li><a href="' + item.text + '">' + item.from_user_id + '</a></li>');
            });
        }
    });
  • 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-20T11:44:58+00:00Added an answer on May 20, 2026 at 11:44 am

    You have to use data.results

    $.ajax({
        dataType: 'jsonp',
        url: 'http://search.twitter.com/search.json?callback=?&q=twitter&rpp=5',
        success: function (data) {
            $.each(data.results, function(i,tweet){
                alert(tweet.text);
                //$('#twitter ul').append('<li><a href="' + item.text + '">' + item.from_user_id + '</a></li>');
            });
        }
    });
    

    You can find a working sample here.

    Updated:

    I think you are new to javascript and json data format.

    The data returned by the request http://search.twitter.com/search.json?callback=?&q=twitter&rpp=5 is in json format. The response for the request contains a key value pair. If you copy paste the request url in your browser you can see the result of the query.

    It starts with {results: [….]}, it means that the json object contains an array of items which can be accessed used the key results.

    Each item in the results array contains the following values

    {
        "from_user_id_str":"",
        "profile_image_url":"",
        "created_at":"",
        "from_user":"",
        "id_str":"",
        "metadata":{"result_type":"recent"},
        "to_user_id":null,
        "text":"",
        "id":,
        "from_user_id": 0,
        "geo":null,
        "iso_language_code":"en",
        "to_user_id_str":null,
        "source":""
    }
    

    each of these key/values can be accessed with the the $.each(function(i, tweet){ .... }) using tweet.<key name>. Ex: tweet.from_user_id_str, tweet.text, tweet.source etc…

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:

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.