javascript - How do you store FB api response? -
i trying following code. want html.concat(name)
line work. html
string.
function getname() { var name = fbname(function(name){ alert(html); //works alert("getname: " + name); //works html.concat(name); //fails? alert(html); // failed: html remains unchanged }); }; function fbname(callback){ fb.api('/' + user_id + '?fields=name', function(response) { callback(response.name); }); }; getname();
strings in js immutable html.concat(name);
not modify value of html
returns new string. use html = html.concat(name);
instead.
Comments
Post a Comment