I am using google plus button on my website and on the click of that I want to trigger my custom ajax to perform some action but it’s not working also I have to pass my custom attribute (some id) to that button but not getting it on it’s callback.

Here is my code…

<div id="test" class="g-plusone" href="<?php echo $campaign_id; ?>" data-callback='gplus_call' data-size="medium"></div>

where $campaign_id is coming dynamically.

<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/platform.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  function gplus_call (object)
        url:'   <?php echo plugin_dir_url(__FILE__); ?>ajax.php',

I only get href and state in console where url is the page url not my campaign_id also ajax does not work and no error.

Please help me!

Read more here: custom attribute and ajax on google plus button callback


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: