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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:54:45+00:00 2026-05-18T01:54:45+00:00

I’m using mootool’s Request.JSON to retrieve tweets from Twitter. After I receive it, I

  • 0

I’m using mootool’s Request.JSON to retrieve tweets from Twitter.
After I receive it, I write to the .innerHTML property for my target div.
When I test this locally as a file, i.e. file:// is in the URL, I see my formatted tweets on the webpage.
When I serve this from my local webserver, i.e. http://, the formatted tweets are not showing up in my div.

What could be causing this? (I’ve tested this in Safari and Chrome on OSX…same behavior)
I’ve included the code that’s from the HEAD section of my page.
Also, when I debug the Javascript in Safari:

“TypeError: Result of expression ‘data’ [undefined] is not an object” appears for the onComplete callback function declaration.

<script type="text/javascript" src="js/mootools-1.3-full-compat.js"></script>
<script type="text/javascript" src="js/jquery-1.4.3.js"></script>
<script type="text/javascript" src="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js"></script>
<script type="text/javascript">
    var jSonRequest = new Request.JSON(
    {
        url:'http://search.twitter.com/search.json?q=+nytimes+OR+TheEconomist',
        onSuccess: function(data) {
            var target = document.getElementById('twitter_content');
            target.innerHTML = ''; //clear the contents
            for(var i = 0; i < data.results.length ; i++) {
                var tweet = data.results[i];

                //process it and add html for hashtags and links
                var processed_tweet_text = tweet.text;

                //process HTTP urls first...otherwise we would get the added links for the hashtags
                var twre = /(http\:\/\/[a-zA-Z0-9.\/]+)/ig
                processed_tweet_text = processed_tweet_text.replace( twre, '<a href="$1">$1</a>' );

                //process hashtags and add link
                twre = /\@([a-zA-Z0-9_\-]+)/ig; //match twitter accounts starting with @ and includes and of these characters: a-z, A-Z, 0-9, "_" and "-" characters.
                processed_tweet_text = processed_tweet_text.replace( twre, '<a href="http://twitter.com/$1">@$1</a>' );

                target.innerHTML += '<div class="tweet"><a href="http://twitter.com/' + tweet.from_user + '">' + '<img src="' + tweet.profile_image_url + '"><div class="tweet_text"><div class="tweet_user"><a href="http://twitter.com/' + tweet.from_user + '">' + tweet.from_user + '</a></div><div class="tweet_message">' + processed_tweet_text + '</div></div></div>';
                //console.log(tweet.from_user); 
            }
        }
    }).send();
</script>

UPDATE

OK. So I’ve found two answers…one with mootools and one with jQuery…thanks to everyone’s suggestions.

For mootools, make sure you get the “more” .js file with the Request.JSONP class http://mootools.net/more/
(I was pulling my hair out because I was getting a constructor error…and I finally realized that I didn’t have the Request.JSONP class!!!)

Then just change code to this:

var jSonRequest = new Request.JSONP(
{...

For JQuery:

//adding callback=? forces a JSONP call...so no issues with AJAX cross-domain requests  
$.getJSON("http://search.twitter.com/search.json?q=+nytimes+OR+TheEconomist&callback=?",
  function(data) {...
  • 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-18T01:54:46+00:00Added an answer on May 18, 2026 at 1:54 am

    Try using new Request.JSONP instead of new Request.JSON.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.