How to share via twitter?


How do I create a function (without jquery) called tweetIt in JS that can share information from my page to Tweeter ?

function tweetIt() {
// some code here that can share information to twitter

My HTML code is like this:

button type=“button” class=“btn btn-primary btn-lg” onclick=“tweetIt( )”>Share Movie</button

If visitor click the button called Share Movie, he can share the information about that particular movie to twitter.

I already read documentation about Tweet Web Intent but still can’t understand how to do it

You can use and use Twitter Web Intent URL with it.

Thanks Kev @kevcomedia, it works now

function tweetIt() {
urlFullTmdb = urlTmdb + tmdbId;
urlFullPoster = urlImage + poster_path;
var url = “” + title + " " + urlFullTmdb + " " + urlFullPoster;, ‘_blank’);