So, here is my code
<script>
var callbackFunction = function(data) {
var temp = data.query.results.channel.item.condition.temp;
console.log(temp);
return temp;
}
var $temp = callbackFunction;
</script>
<script src="https://query.yahooapis.com/v1/public/yql?q=select%20item.condition%20from%20weather.forecast%20where%20woeid%20%3D%202487889&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys/&format=json&callback=callbackFunction"></script>
The code "works". I can see the value in the console. But I can't manage to convert the local variable "temp" to the global variable "$temp". I tried this also :
var $temp = callbackFunction();
It doesn't work. I also tried this :
var callbackFunction = (function (data) {...}) ();
This doesn't work for this, but I tried this solution with something else, and it worked.
Thank you!