title: Dealing with facebook Graph API objects in javascript
body: <p>I am trying to access specific albums via their location from a Facebook page via a graph API call and ultimately display them on a webpage. </p>
  
  <p>Essentially I think I need to loop through the object that Facebook sends back (<strong>response</strong> in this case) and only store objects which contain the substring "Germany" in the location description to the variable <strong>albums</strong>. Currently nothing happens in the console when I trigger the method.</p>
  
  <p>I'm kind of stuck at this point, I can make API calls and have them returned from the specific page via other functions, so my permission seems to be fine, I'm just structuring this function incorrectly (I think, I'm relatively new to JS and Jquery).</p>
  
  <pre><code>model.getPhoto = (function(data){
      var albums;
      FB.api(
          '/--USER ID GOES HERE--/albums',
          'GET',
          {"fields":"link,location"},
          function(response){
              for (var i=0; i&lt;response.length; i++){
                  if (response.albums.location[i] = "Germany"){
                      albums = response.albums.location[i];
                      i++;
                  }
                  console.log(albums);
              }
          }
      );
  });
  </code></pre>