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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:43:04+00:00 2026-05-26T03:43:04+00:00

I have the code: <script type=text/javascript charset=utf-8> var hash = fifa; $(document).ready(function() { console.log(I

  • 0

I have the code:

<script type="text/javascript" charset="utf-8">
    var hash = "fifa";

    $(document).ready(function() {
        console.log("I am ready");
        $('#trigger_but').click(function() {
            console.log("Click Performed");
            $.getJSON("http://search.twitter.com/search.json?rpp=100&callback=?&q=%23" + $('#hash_tag_input').val(), function(data) {
                for (var i = 0; i < data.results.length; i++) {
                    $('#result').prepend('<div class="tweet"><img src="' + data.results[i].profile_image_url
                            + '" width="50" height="60"/><span id="tweetText">' + data.results[i].text + '</span></div>');
                }
            });
        });
    });

</script>
</head>
<body>
<input type="text" id="hash_tag_input" size="40"/>
<input type="button" id="trigger_but" value="Fetch Tweets"/>

<div id="result"></div>
</body>

How would I make it so that I can use the variable hash, instead of the inputted contents of hash_tag_input as the search term. And make it so that it fetches the tweets automatically without the click of a button.

  • 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-26T03:43:05+00:00Added an answer on May 26, 2026 at 3:43 am

    For part 1, replace $('#hash_tag_input').val() with hash.
    For part 2, just put the getJSON call directly in $(document).ready, like this:

    var hash = "fifa";
    
    $(document).ready(function(){
        $.getJSON("http://search.twitter.com/search.json?rpp=100&callback=?&q=%23"+hash,function(data){
             for(var i=0;i<data.results.length;i++){
                 $('#result').prepend('<div class="tweet"><img src="'+data.results[i].profile_image_url + '" width="50" height="60"/><span id="tweetText">'+data.results[i].text+'</span></div>');              
             }
        });  
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I have this code: <script language=javascript type=text/javascript> <!-- function requestPage(page) { var request
So in default.aspx I have the code <script type=text/javascript> function validateForm() { test(); //here
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have this code in userpage.php: <script langauge=JavaScript><!-- function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); } //--></script>
I have written the following in a JavaScript method : <html> ... <script type=text/javascript
I have this code function calculateTotal() { var total = 0; $(.quantity).each(function() { if
<html> <head> <meta http-equiv=Content-Type content=text/html; charset=UTF-8> <title>Login Page</title> </head> <br><br><br><br> <body style=background-color: cornflowerblue >
I have java script code to set some of the properties of ajax controls.
I have a java script code that works fine when run through a browser,
I have developed code on a m-file script in Matlab that communicates with a

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.