"Invalid App Id" error on "Like" button Facebook

-1

I'm doing a blog and I'm putting the like button. The code I'm using is:

This is at the top of the page:

<script>    
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));
</script>

And to put the button I do so:

<div class="fb-like" data-href="@String.Format("{0}/{1}", "/Blog/Artigo", @item.ArtigoID)" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>           

Looking at the Google Chrome console, I see 2 alerts when I am not logged in to Facebook which are:

Invalid App Id: Must be a number or numeric string representing the application id. all.js:53
FB.getLoginStatus() called before calling FB.init(). all.js:53

Why does this happen? What should I be doing wrong?
Is there any way I can not use Facebook's JS and do something that opens a modal for the user to do the like ? So to get the total of like has, but to give like I did not find it.

    
asked by anonymous 07.05.2014 / 01:30

1 answer

0

The App Id is missing. See this line here:

js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1";

It has to look like this:

js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=SeuAppIdDe16Dígitos";
    
07.05.2014 / 01:54