0

Hi for some reason when I invoke GET methodes from a simplemodal dialog they fail with the following error:

Uncaught TypeError: Cannot call method 'toLowerCase' of undefined

the error occurs at line 10 in the facebooks all.js. The same methode succeed when called not from the modal dialog. Also any post method succeed from the modal dialog as well.

The method is a trivial one:

FB.api(postId,'GET', function(response) {
 alert('hello');
} 
3
  • The error is when something is trying to do string manipulation on an unidentified variable. Where is the js and where is the html? Seems your call is TOO trivial developers.facebook.com/docs/reference/javascript/FB.api - first parm is likely a url, like /xxx/yyy - and who says you can use GET? Commented Jun 19, 2011 at 10:32
  • postId is a variable with the url (actually with the post id). I'm trying to retrieve the post here. I know that 'GET' is a default but it is ok to specify it also. As I said the same request works when called not from a modal dialog Commented Jun 19, 2011 at 10:43
  • I meant - is GET allowed at all? The REST interface is being deprecated and I do not see your syntax anywhere in the documentation Commented Jun 19, 2011 at 11:18

1 Answer 1

1

I had the same problem with a delete call like this:

FB.api( id, 'delete', function(response) {
    console.log(response);
});

It turns out the problem was that the id was an integer and not a string. I got the id from the URL with PHP and cast it to an int and then output it as javascript using json_encode, so I just had to cast it back to a string to solve the problem. One way to do this with javascript is like this:

var int = 10;
console.log( '' + int );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.