We add a Default Tweet Button API on my site. it's work perfect and load new window and send the tweet.
but i want to get the value of the tweet count id. or if anybody click on the tweet button and submit a tweet .
then my page show an alert message .
aler "Tweet send succefully."
Please help me how we can do this. Thanks

//Here is the API
    <html>
    <script type="text/javascript">
    window.twttr=(function(d,s,id){
    var t,js,fjs=d.getElementsByTagName(s)[0];
    if(d.getElementById(id)){
    return
    }
    js=d.createElement(s);
    js.id=id;
    js.src="https://platform.twitter.com/widgets.js";
    fjs.parentNode.insertBefore(js,fjs);
    return window.twttr||(t={_e:[],ready:function(f){
    t._e.push(f)

    }})}
    (document,"script","twitter-wjs"));

    </script>

    <script>
    function myFunction() {
        var x = document.getElementById('count');
        document.getElementById("result").innerHTML = x;
        aler ('tweet send succesfully. ';
    }

    </script>
    <body>

    <a onclick="myFunction()" class="twitter-share-button"  href="https://twitter.com/share"  target="_blank">
    Tweet
    </a>
    <p id="result"></p>




</body>
</html>

Recommended Answers

Is your problem that counts are not being shown on page? as far as message is concerned it is showing your tweet has been posted succesfully.

Jump to Post

All 2 Replies

Is your problem that counts are not being shown on page? as far as message is concerned it is showing your tweet has been posted succesfully.

Hi @imti321 thanks for reply.
if we click on tweet button on my site and open a new tab there is a button like Tweet
if we click that button tweet was send . now get back to my site page and here i want to confirm tweet is send successfully or not.

maybe anybody click on the tweet button on my site but after click they could not send a tweet from twitter page .
can you help me to do this.
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.