Carl Mark
Carl Mark

Reputation: 371

TypeError: response.data is undefined Facebook api

I would like to use this tutorial: http://www.webtuts.info/webdevelopment/facebook-download-script-2/225/. And I only change the appId. And I get this error:

TypeError: response.data is undefined
[Break On This Error]   

...( response.data.length == 1 ) { //there should only be a single value inside "da...

Here is my code: http://pastebin.com/dz3LMWaP Can anybody help me whats the problem?

Upvotes: 0

Views: 2249

Answers (2)

Tomer Arazy
Tomer Arazy

Reputation: 1823

It's impossible to tell what is the problem since there could be many reasons - add this to your code right before the line in your post, it won't fix your problem but it'll give your more exact info that on what is the problem.

if (response.error) {
      console.log('Error - ' + response.error.message);
      return
}    

Upvotes: 1

Schleis
Schleis

Reputation: 43800

response does not contain a property data so when you try to get the length of it, Javascript throws an error.

You will want to examine response via console.log().

Upvotes: 0

Related Questions