0
我以下的問題:我建立一個報價發生器(freecodecamp)和需要能夠送通過Twitter野兔報價。我的方法是通過Twitter網絡意圖,文本是我通過API接收的數據。它只能使用一次。Twitter分享自定義文本 - 只能一次
HTML:
<p>Share the wisdom</p>
<a class="twitter-share-button" href="#" target="_blank">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
JS:
<script>
function myFunction() {
var firstName = document.getElementsByName("firstname")[0].value;
var trumpAPI = "https://api.whatdoestrumpthink.com/api/v1/quotes/personalized?q="+firstName;
$.getJSON(trumpAPI, function(data, status){
document.getElementById("trump").innerHTML = data.message;
$('a[href="#"]').attr("href","https://twitter.com/intent/tweet?text="+data.message+"&hashtags=trump, quoteoftheday");
});
document.getElementById("trump").classList.add("border");
}
</script>
難道是在web意圖文本參數不是動態的?任何建議如何解決這個問題?提前致謝。
感謝您的快速回答/修復,並遺憾未詳細解釋。這確實是一個快速解決方案。 [看到它在這裏工作](http://onlygreatquotes.com/) – Mario