Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send tweet to twitter with jquery inside my site

Tags:

jquery

tweets

There is MANY API and script and plugin out there to get feed, hash tag and tweet from twitter. I like to SEND tweet TO twitter from my site with jquery

something like

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

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

})

it's it something possible ?

now i use :

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

but that take the title of the page to send it to twitter.. not really what i want !

like image 756
menardmam Avatar asked Oct 13 '11 21:10

menardmam


1 Answers

What's wrong 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 set it dynamically via:

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

UPDATE: If you're just trying to use your own Twitter button, you can simply use web intents, Twitter's fancy way of saying "regular old URLs". See: https://dev.twitter.com/docs/intents

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

Since it's part of a URL, make sure you urlencode all the parameters.

like image 62
Chris Pratt Avatar answered Oct 15 '22 18:10

Chris Pratt