Why is this global variable not being changed???
Posted
by
user398314
on Stack Overflow
See other posts from Stack Overflow
or by user398314
Published on 2011-02-15T15:14:35Z
Indexed on
2011/02/15
15:25 UTC
Read the original article
Hit count: 178
Why does this turn up null instead of being set to the data returned from the ajax call? It must be something simple i am overlooking.
var message;
$(document).ready(function(){
fbFetchMessage();
alert(message);
});
function fbFetchMessage(){
var url = "http://graph.facebook.com/companyname/feed?callback=?";
$.getJSON(url,function(json){
message = json.data[0].message;
});
}
© Stack Overflow or respective owner