title: FB.Event.subscribe('comment.create') run 2 times when create a comment from a facebook comment web plugin
body: <p>I want to call an ajax 1 time function whenever someone create a comment on the facebook comment plugin. But the sever call the ajax function twice.</p>
  
  <p>I have already looked up for a day but nothing can help me. </p>
  
  <p>here is my code</p>
  
  <pre><code>window.fbAsyncInit = function fb() {
      FB.Event.subscribe('comment.create', function () {
          function csrfSafeMethod(method) {
              // these HTTP methods do not require CSRF protection
              return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
          }
  
          $.ajaxSetup({
              beforeSend: function (xhr, settings) {
                  if (!csrfSafeMethod(settings.type) &amp;&amp; !this.crossDomain) {
                      xhr.setRequestHeader("X-CSRFToken", csrftoken);
                  }
              }
          });
  
          $.ajax({
              url: 'http://127.0.0.1:8000/ajax/comment/',
              type: "POST",
              data: {
                  'id': $('#fbcomment').attr('data')
              },
              dataType: 'json',
              success: () =&gt; {
  
              }
          });
      });
  
  };
  </code></pre>
  
  <p>Here is my facebook js (I put it before <code>&lt;body&gt;</code>):</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
    &lt;script&gt;(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 = 'https://connect.facebook.net/vi_VN/sdk.js#xfbml=1&amp;version=v3.2';
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    &lt;/script&gt;
  </code></pre>
  
  <p>my <code>urls.py</code> link:</p>
  
  <pre><code>re_path(r'^ajax/comment/$', views.Action.comment, name='comment'),
  </code></pre>
  
  <p>here is the view:</p>
  
  <pre><code>    def comment(request):
          id = int(request.POST.get('id'))
          film = get_object_or_404(Film, pk=id)
          film.comment = film.comment + 1
          film.save()
          return JsonResponse(id, safe=False)
  </code></pre>
  
  <p>Please help me.
  sorry for my poor english.</p>
  
  <p><a href="https://i.stack.imgur.com/IuV9u.jpg" rel="nofollow noreferrer">This is what i get</a></p>