Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Tweet button with AJAX content
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
danny  
View profile  
 More options Sep 20 2010, 7:45 am
From: danny <dco...@gmail.com>
Date: Mon, 20 Sep 2010 04:45:44 -0700 (PDT)
Local: Mon, Sep 20 2010 7:45 am
Subject: Tweet button with AJAX content
I've searched and searched without any luck.

I have AJAX content coming in, rendered in HTML with Tweet buttons all
over the place.

Problem is, the Tweet button does not work (since it appears the
Twitter Javascript goes through the loaded page DOM to enable the
Tweet button links AFTER the page load).

Right now I am manually generating the URL to forward the user to the
Twitter message page on a new window.
And I don't want to create a Javascript to pop it up in a centered
window with a fixed size since I want to stick to what Twitter has
already provided in their JS.

So anyone figure out how to make the Tweet button work with AJAX
content? The only hack I can think of is to unload the Twitter
Javascript from the HTML DOM and when AJAX content comes in...reload
the Twitter Javascript (I know...it's a very bad hack)

Suggestions? Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cairo Noleto  
View profile  
 More options Sep 26 2010, 8:04 pm
From: Cairo Noleto <caironol...@gmail.com>
Date: Sun, 26 Sep 2010 21:04:26 -0300
Local: Sun, Sep 26 2010 8:04 pm
Subject: Re: [twitter-dev] Tweet button with AJAX content

Hi, I have the same problem. Someone can help us?

--
Atenciosamente,

Cairo Noleto 
Visits http://www.caironoleto.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A. Jesse Jiryu Davis  
View profile  
 More options Sep 27 2010, 10:22 am
From: "A. Jesse Jiryu Davis" <ajesseda...@gmail.com>
Date: Mon, 27 Sep 2010 07:22:38 -0700 (PDT)
Local: Mon, Sep 27 2010 10:22 am
Subject: Re: Tweet button with AJAX content
I have a similar problem, on this page:

 http://emptysquare.net/photography/homeless-shelters/#1/

I use this jQuery code to regenerate the Tweet button each time Ajax
content changes:

 var tweet_button = $('#tweet_button_container');

        tweet_button.html(
        '<a href="http://twitter.com/share" class="twitter-share-button" data-
count="horizontal" data-via="jessejiryudavis" data-url="'
        + document.location.href
        + '" data-counturl="'
        + document.location.href
        + '">Tweet</a><script type="text/javascript" src="http://
platform.twitter.com/widgets.js"></script>'
        );

... and that works, but the Tweet-count is always 0 when I reload the
page, no matter how many times I've tweeted the URL.

Tweet buttons with Ajax content seem like a common case, can we get
some guidance about implementing it correctly?

Thanks,
Jesse

On Sep 26, 8:04 pm, Cairo Noleto <caironol...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Reginald James  
View profile   Translate to Translated (View Original)
 More options Oct 7 2010, 9:21 pm
From: Mark Reginald James <m...@bigpond.net.au>
Date: Thu, 7 Oct 2010 18:21:32 -0700 (PDT)
Local: Thurs, Oct 7 2010 9:21 pm
Subject: Re: Tweet button with AJAX content
That's great Jesse that you've found a method that works. I didn't
know that was a way to force a reload of widget.js.

Note that widget.js only needs to be re-sourced once to render all
Tweet buttons on the page, so you can just render plain tweet links
and then re-source the script.

An alternative method I've found successful is to take a local copy of
widget.js and give its main function a name:

  var twttr=window.twttr||{};(twttr.showWidgets = function()...

(Note that the parenthesis and the end has to be moved before the
"()").

The AJAX response can the just include a "twttr.showWidgets()" call.

Twitter should really alter widget.js to do something similar, just
like the Facebook sharer allows you to call "FB.Share.renderPass()".

Another alternative that should work, but doesn't, probably because of
a Twitter bug, is to render the button directly as an iframe, as
described at http://dev.twitter.com/pages/tweet_button . AJAX updates
then work fine, except for a JavaScript error about a missing
twttr.updateTweetCount function. Is this a bug in
http://platform.twitter.com/widgets/tweet_button.html ?

Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Reginald James  
View profile  
 More options Oct 10 2010, 8:07 pm
From: Mark Reginald James <m...@bigpond.net.au>
Date: Sun, 10 Oct 2010 17:07:49 -0700 (PDT)
Local: Sun, Oct 10 2010 8:07 pm
Subject: Re: Tweet button with AJAX content
I'm no longer seeing the updateTweetCount error when rendering the
iframe directly, so this looks like the best method to allow AJAX
updates.

An additional advantage is that you can make the iframe slightly
bigger than that generated by the Twitter JS, eliminating clickjacking
warnings from the NoScript Firefox plugin.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »