如何在我的网站内使用jquery将推文发送到twitter [英] How to send tweet to twitter with jquery inside my site

查看:100
本文介绍了如何在我的网站内使用jquery将推文发送到twitter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有许多API和脚本以及插件,可以从Twitter获取提要,哈希标签和推文.我想用jquery从我的网站发送Twitter推文

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

类似

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

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

})

有可能吗?

现在我使用:

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

但是将页面标题发送给Twitter ..并不是我真正想要的!

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

推荐答案

出了什么问题:

<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');

更新:如果您只是想使用自己的Twitter按钮,则可以简单地使用Web意向,这是Twitter所说的常规旧URL"的一种奇特的方式.请参阅: https://dev.twitter.com/docs/intents

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]

由于它是URL的一部分,因此请确保对所有参数进行urlencode.

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

这篇关于如何在我的网站内使用jquery将推文发送到twitter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆