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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -