How to send twitter to twitter with jquery inside my website

There is a lot of API and script and plugin to get feed, hash tag and tweet from twitter. I like to SEND a twitter twitter from my site using jquery

sort of

$('#somebutton').click( function (){

var text='some intelligent things to say';
#.twitit(text);

})

Is it possible?

now i use:

<a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet it</a></div>

but it will take the title of the page to tweet it. Not exactly what I want!

+5
source share
2 answers

What happened with:

<a href="https://twitter.com/share" class="twitter-share-button" data-text="Something other than page title" data-count="vertical">Tweet it</a></div>

You can even install it dynamically with:

$('.twitter-share-button').attr('data-text', 'Some text to tweet');

: Twitter, -, " URL-". .: https://dev.twitter.com/docs/intents

https://twitter.com/intent/tweet?url=[your URL]&text=[some text to tweet]

URL-, , .

+8

, ... !

<script>
$(document).ready(function(){
    $('a[data-text]').each(function(){
      $(this).attr('data-text', "This works!");
    });
    $.getScript('http://platform.twitter.com/widgets.js');
});
</script>

<a href="http://twitter.com/share"
    class="twitter-share-button"
    data-text="This is what we want to change dynamically"
    data-count="none" data-via="chris_camps">Tweet</a>
<!-- moved to the js above <script type="text/javascript"
    src="http://platform.twitter.com/widgets.js"></script> -->
0

All Articles