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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:14:22+00:00 2026-05-23T16:14:22+00:00

I’m trying to get the last 50 tweets using a certain hash tag, on

  • 0

I’m trying to get the last 50 tweets using a certain hash tag, on a mobile device using PhoneGap (0.9.6) and jQuery (1.6.1). Here’s my code:

function getTweets(hash, numOfResults) {
    var uri = "http://search.twitter.com/search.json?q=" + escape(hash) + "&callback=?&rpp=" + numOfResults;
    console.log("uri: " + uri);
    $.getJSON(uri, function(data) {
        var items = [];
        if(data.results.length > 0) {
            console.log("got " + data.results.length + " results");
            $.each(data.results, function(key, val) {
                var item = "<li>";
                item += "<img width='48px' height='48px' src='" + val.profile_image_url + "' />";
                item += "<div class='tweet'><span class='author'>" + val.from_user + "</span>";
                item += "<span class='tweettext'>" + val.text + "</span>";
                item += "</div>";
                item += "</li>";
                items.push(item);
            });
        }
        else {
            console.log("no results found for " + hash);
            items.push("<li>No Tweets about " + hash + " yet</li>");
        }
        $("#tweetresults").html($('<ul />', {html: items.join('')}));
    });
}

This code works great in a browser, and for a while worked in the iPhone simulator. Now it’s not working on either the iPhone or Android simulator. I do not see any of the console logs and it still works in a browser.

What am I doing wrong? If it’s not possible to call getJson() on a mobile device using PhoneGap, what is my alternative (hopefully without resorting to native code – that would beat the purpose).

Bonus: how can I debug this on a mobile simulator? In a browser I use the dev tools or Firebug, but in the simulators, as mentioned, I don’t even get the log messages.

As always, thanks for your time,

Guy

Update:
As @Greg intuited, the function wasn’t called at all. Here’s what I found and how I bypassed it:
I have this <a> element in the HTML <a href="#" id="getTweets">Get tweets</a>
Then I have this code in the $(document).ready() function:

$("#getTweets").click(function() {
  var hash = "#bla";
  getTweets(hash, 50);
});

That didn’t call the function. But once I changed the code to:

function gt() {
  var hash = "#bla";
  getTweets(hash, 50);
}

and my HTML to:

<a href="javascript:gt()" id="getTweets">Get Tweets</a>

it now works and calls Twitter as intended. I have no idea what’s screwed up with that particular click() binding, but I ran into similar issues with PhoneGap before. Any ideas are appreciated.

  • 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-23T16:14:23+00:00Added an answer on May 23, 2026 at 4:14 pm

    Considering that (a) there isn’t much that could go wrong with the first line of your function and (b) the second line is a log command, then it would seem that the function isn’t being called at all. You’ll have to investigate the other code in your app.

    Or are you saying that you don’t have a way to read logged messages on your mobile devices?

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported

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.