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 8921149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:28:00+00:00 2026-06-15T06:28:00+00:00

I want to search a tweet from twitter, it will depend on text or

  • 0

I want to search a tweet from twitter, it will depend on text or hashtag. Then Show it on <div id="result"> . but i get confused because my code doesn’t show the tweet.

Here is my code to read JSON from twitter search :

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function()
    {

        $('#btn').click(function()
        {
            $.getJSON("http://search.twitter.com/search.json?q="+$('#search').val(),function(data)
            {
                $.each(data.results, function(i,data){
                    var from = data.from_user;
                    var tw_content = data.text;

                    $('#result').append("<p>User : "+from+"<br>Tweet : "+tw_content+"</p>");
                });
            });
        });

    });

</script>

<input type="text" id="search"/><input type="button" id="btn" value="cari"> 

<div id="result">

</div>

And while I run this, nothing happen. anyone can help me ?

  • 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-06-15T06:28:02+00:00Added an answer on June 15, 2026 at 6:28 am

    I would do something like below:

        $(document).ready(function() {
      // Declare variables to hold twitter API url and user name
      var twitter_api_url = 'http://search.twitter.com/search.json';
      var twitter_user = 'behudinnystrom';
    
      // Enable caching
      $.ajaxSetup({ cache: true });
    
      // Send JSON request
      // The returned JSON object will have a property called "results" where we find
      // a list of the tweets matching our request query
      $.getJSON(
        twitter_api_url + '?callback=?&rpp=5&q=from:' + twitter_user,
        function(data) {
          $.each(data.results, function(i, tweet) {
            // Uncomment line below to show tweet data in Fire Bug console
            // Very helpful to find out what is available in the tweet objects
            //console.log(tweet);
    
            // Before we continue we check that we got data
            if(tweet.text !== undefined) {
              // Calculate how many hours ago was the tweet posted
              var date_tweet = new Date(tweet.created_at);
              var date_now = new Date();
              var date_diff = date_now - date_tweet;
              var hours = Math.round(date_diff/(1000*60*60));
    
              // Build the html string for the current tweet
              var tweet_html = '<div class="tweet_text">';
              tweet_html += '<a href="http://www.twitter.com/';
              tweet_html += twitter_user + '/status/' + tweet.id + '">';
              tweet_html += tweet.text + '<\/a><\/div>';
              tweet_html += '<div class="tweet_hours">' + hours;
              tweet_html += ' hours ago<\/div>';
    
              // Append html string to tweet_container div
              $('#tweet_container').append(tweet_html);
            }
          });
        }
      );
    });
    

    DEMONSTRATION

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

Sidebar

Related Questions

I want to search through a html file and then get the url to
I want to develop an Android app that will fetch geo-tagged tweets from Twitter
I'm parsing tweets from twitter and I want to show dates like twitter posted
Im using linq-to-twitter and I want to pass in a tag to search from
I am using the Twitter GET search for retrieving tweets from a specified account,
I want to search a user from LDAP and after getting the user I
I want to search a text in a table without knowing its attributes. Example
I want to search the computer from this table and when i have stored
I am attempting to pull several @user and #hashtags from the twitter search API.
I'm writing a twitter bot using tweepy that will search for mentions to it

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.