Hello, I have a problem tweeting the quote text, here is the code that generates my button and adds all the content to the tweet, I’m finding it hard to add the actual quote to the tweet.
Please help me
var tweet = $("#target").text();
twttr.widgets.createShareButton(
'http://codepen.io/Alwass89/full/egYMRY/',
document.getElementById('twit'),
{
text: tweet,
size: "large",
hashtags: "coding,codepen"
}
);
also, my API code…
$(document).ready(function(){
function quotes(){
var quoteNow, authorNow;
var make = ( data ) => {
quoteNow = data.quoteText;
authorNow = data.quoteAuthor;
$("#target").html(
"<h3>" + quoteNow + "</h3>" + "</br>"
+ "<p>~ " + authorNow + "</p>"
);
}
$.ajax({
url: "http://api.forismatic.com/api/1.0/?",
dataType: "jsonp",
data: "method=getQuote&format=jsonp&lang=en&jsonp=?",
success: (data) => make(data)
});
}
$(() => quotes());
$("#get-quote").on("click", () => quotes());
});