- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Same 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:
- Android* OS
Link Copied
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page