title: fb share does not take og:image dynamically
body: <p>I am writing a website where i would have several pages(user submitted). These pages would be accessed like <a href="http://www.mywebsite.com/?page=page1" rel="nofollow">http://www.mywebsite.com/?page=page1</a>, <a href="http://www.mywebsite.com/?page=page2" rel="nofollow">http://www.mywebsite.com/?page=page2</a> etc.,  I would want to have a fb-like-share button for each of the pages (after the content is loaded) so that when they click that, it posts that particular page(along with its image) in their fb. So far everything seemed going right for me until i hit this problem that breaks my head last two days. Some forums say open-graph and fb-share are buggy but i still hope my requirement is something global and it must work. </p>
  
  <p>While fb-like and fb-share works fine in sharing the particular URL, it does not pick the right image though. I could define the OG meta tag's in the header but these are bound to change as the pages are loaded through Ajax dynamically. </p>
  
  <p>I overwrite these tags og:url and og:image through jQuery( which shows they are updated ) but fb-share does not read them i guess. (OR How do i test that ? ) </p>
  
  <p>FB debugger tool does not seem to help much since I use ajax methods, it does not show the updated meta tags but shows what is defined in my header first time, so it obviously is not of much help to me. if i hard-code my values in the header (without relying on jquery to overwrite) both of my pages individually work fine with its right contents, count and URL that confirms there is not an issue with cache or these tags or with the images i use. But when i club them all to overwrite through java-script there seem to be a disconnect, not sure where.</p>
  
  <p>According to me this is a problem with meta tags getting overwritten using the jquery.
  Also, I think the fb-share also does not pick the right url's while showing the count next to it. </p>
  
  <p>In short, fb-share does not get overwritten with the new url's (per the page-id i show) as it shows the same count(like/share) for all of my pages and it does not pick the overwritten meta-tag's to display the right pictures. Anything i hardcode it simply works for the page that is hard-coded. </p>
  
  <p>my index.php runs like this (note i have masked the website details and my fb app)..</p>
  
  <pre><code>&lt;head&gt;
  ...
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;meta name="robots" content="noarchive"/&gt;
  &lt;meta name="GOOGLEBOT" content="noarchive"/&gt;
  &lt;meta property="fb:app_id" content="4126120410011204"/&gt;
  &lt;meta property="fb:admins" content="fbuser1"/&gt;
  &lt;meta property="fb:admins" content="fbuser2"/&gt;
  &lt;meta property="og:title" content="MYWEBSITE | A website on cloud being tested..."/&gt;
  …
  
  &lt;/head&gt;
  
  &lt;script&gt;
          $( document ).ready(function() {
  
             …
  
             var selProfID = $("#profileID").val();
  
             if (selfProfID ) { 
               showOneProf(selfProfID);
              }
  
             function showOneProf(uid) {
               ...
              $.ajax({
              type: "POST",
              url: action.php,
              data: {'pageid' : uid},
  
              success: function(results)
              {
  ..          
   $.each(eval(results), function(i,item){
  
  
          …
          $('head').append('&lt;meta property="og:url" content="http://www.mywebsite.com/?page='+item.pageid+'" /&gt;');
          $('head').append('&lt;meta property="og:image" content="http://www.mywebsite.com/uploads/'+item.image+'" /&gt;');
          var linkurl = "http://www.mywebsite.com/?page=page1";
  
             document.getElementById('fblike2').setAttribute('href', linkurl);
             document.getElementById("fbcomments1").setAttribute('href', linkurl);
             FB.XFBML.parse(document.getElementById('fbc'));
             $("#contents").append(results);
           });
          ..
          });
  
  &lt;/script&gt;   
  
  &lt;?php
  ..
  
  $profid = $_GET['page'];
  echo "&lt;input type='hidden' id='profileID' value='$profid'&gt;&lt;BR&gt;";
  
  ..
  &lt;div id='contents'&gt;
  &lt;div id="fbc"&gt;&lt;/div&gt;
  &lt;script&gt;
  function loadfbComments(){
  var elemDiv = document.getElementById("fbc");
  
      var likes = '&lt;div id="fblike2" class="fb-like" data-href="http://www.mywebsite.com" data-layout="button" data-action="like" data-send="true" data-show-faces="true" data-share="true"&gt;&lt;/div&gt;';
      var markup = '';
          markup += '&lt;div id="fbcomments1" class="fb-comments" data-colorscheme="light" data-href="http://www.mywebsite.com" data-order-by="reverse" data-num-posts="10" data-width="682" style="margin-top:2em;"&gt;&lt;/div&gt;';
          elemDiv.innerHTML = "&lt;BR&gt;" + likes + "&lt;BR&gt;" + markup;
          FB.XFBML.parse(elemDiv);
  }
  loadfbComments();
  
                  &lt;/script&gt;
                  &lt;script type="text/javascript" src = "//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=09090909090909"&gt;&lt;/script&gt;
  ..  
  &lt;/div&gt;
  ?&gt;
  </code></pre>
  
  <p>Please help if you think i am making any silly mistakes here. Thanks a lot.</p>
  
  <p>PK</p>