Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Pablo_O_
Beginner
47 Views

Intel XDK javaScript Jquery

1 ja.pngSame one Know how can i use a global variable from and javascript and used in other javascript Jquery in the same page.

this is my gloval variable "geos" in my HEAD page

geos = document.value=results[0].formatted_address;

and i need make it work in this Jquery

<div id="button-parent-example"></div>
<script src="css/jquery-1.11.2.min.js"></script>
<script>
 
    (function($){
      $(document).ready(function(){
        
        var $buttonParent = $('#button-parent-example');

        var title = encodeURIComponent(document.title);
          xxx= $("geos");
        var geos3 = '%20MENSAJE%20DE%20PRUEBA:%20Estoy%20en: ' + xxx + ' ';
        var url = encodeURIComponent(document.URL);  
          
        var $buttonContent = $('<a class="wa-share" href=whatsapp://send?text=' + title + geos3 + '><IMG id="sos" style="HEIGHT: 57px; WIDTH: 57px" border="3" src="images/sos.png" width="150" height="165"></a>');
          
        $buttonContent.on('click', function(){
          
          window.ga('send', {
            'hitType': 'social',
            'socialNetwork': 'whatsapp',
            'socialAction': 'share',
            'socialTarget': document.URL,
            'hitCallback': function() {
              if(window.console) {
                console.log("Send suoritettu. Katso UA raporteilta kohdasta Acquisition > Social > Plugins");
              }
            }
          });
        });
        
        $buttonParent.append($buttonContent);
      });
    }(window.jQuery));
  </script>

as you see same thing its WRONG in my variable "XXX" to call "GEOS", the button disapear

 xxx= $("geos");
        var geos3 = '%20MENSAJE%20DE%20PRUEBA:%20Estoy%20en: ' + xxx + ' ';
        var url = encodeURIComponent(document.URL); 

Tags (1)
0 Kudos
0 Replies
Reply