How to use the global variable topic outside the function which is assigned to global variable tell.
<html>
<head>
<script>
alert(topic);
tell = function(){
topic = "something";
};
</script>
</head>
<body>
</body>
</html>
Eventually I want to use the value of topic_splitted anywhere outside the function.
client.onMessageArrived = function (message) {
topic_splitted = message.destinationName.split("/");
console.log("Topic Splitted: " + topic_splitted);
console.log("Message Topic: " + message.destinationName);
console.log("Message Arrived: " + message.payloadString);
if (message.destinationName == "in_progress"){
if (message.payloadString == "false") {
stepCode();
}
}
var new_data = JSON.parse(message.payloadString);
$.extend(true, data, data, new_data);
};