简体   繁体   English

任何人都可以通过Twitter帮助我吗?

[英]Can anyone help me with Twitter?

My website is allow user tweet request to twitter. 我的网站允许用户向Twitter发推文请求。 When they click on tweet, default text of the request will come out, and user can also edit it. 当他们单击推文时,请求的默认文本将会出现,用户也可以对其进行编辑。 Below is sample source code: 下面是示例源代码:

Code

$tweet="Hello, everybody";

<a href="https://twitter.com/share" class="twitter-share-button" id="id" 
data-text="'.$tweet.'" data-lang="ja" data-size="large" data-count="none" 
data-url="none">Tweet</a>

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); 
}}(document,"script","twitter-wjs");</script>

If user change text from "Hello, everybody" to the text that they want, so can i get the text that user change after tweet or not? 如果用户将文本从“大家好,您好”更改为他们想要的文本,那么我能否在推特后获取用户更改的文本?

Thank in advance. 预先感谢。

First idea that comes to my mind (that actually rather seems like a 'quick hack') is registering a new onclick listener to the 'send tweet' button. 我想到的第一个想法(实际上似乎是“快速破解”)是将新的onclick侦听器注册到“发送推文”按钮。 You could try and get the value of the textarea and send it to php via an ajax-request. 您可以尝试获取textarea的值,然后通过ajax请求将其发送到php。

something like: 就像是:

function my_onclick() {
   var text = $(selector for textare).innerHTML();
   $.ajax({
      type: "POST",
      url: url,
      data: text,
      success: success,
      dataType: dataType
   });

I know I did it like this once... but this is probably not the most elegant way to do it! 我知道我曾经这样做过……但这可能不是最优雅的方式!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM