title: Follow Ajaxify Link with Javascript
body: <p>I'm attempting to create a greasemonkey script that will automatically poke (well, repoke) people on facebook. However, it is only the specific people I designate. This is easy to do as I can display the HTML that displays the poke using their specific uid using this:</p>
  
  <pre><code>document.getElementById("poke_uidhere").innerHTML;
  </code></pre>
  
  <p>This yields the code/link/ajax to repoke them:</p>
  
  <pre><code>&lt;div class="lfloat fsm fwn fcg"&gt;&lt;a href="https://www.facebook.com/profile.php?id=uidhere"&gt;FRIEND NAME&lt;/a&gt; · &lt;a ajaxify="/ajax/poke_dialog.php?uid=uidhere&amp;amp;pokeback=1" rel="dialog-post"&gt;Poke Back&lt;/a&gt;&lt;/div&gt;&lt;a class="rfloat uiCloseButton uiCloseButtonSmall" ajaxify="/ajax/poke_hide.php?p=uidhere" href="#" rel="async-post" title="Remove"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Note that I again replaced the uid to maintain anonymity(or however that's spelled). </p>
  
  <p>So I can see that when I poke them back I am following</p>
  
  <pre><code>&lt;a ajaxify="/ajax/poke_dialog.php?uid=uidhere&amp;amp;pokeback=1" rel="dialog-post"&gt;Poke Back&lt;/a&gt;
  </code></pre>
  
  <p>However, when I used this code:</p>
  
  <pre><code>previousInnerHtml = document.getElementById("poke_uidhere").innerHTML;
  previousInnerHtml = previousInnerHtml.replace('rel="dialog-post"', 'rel="dialog-post" id="loganspoker"');
  document.getElementById("poke_uidhere").innerHtml = previousInnerHtml;
  document.getElementById("loganspoker").click();
  </code></pre>
  
  <p>It does not click at all. It actually stalls here because I added an alert() after it and the alert never came up. </p>
  
  <p>I gave up this method and began to simply try to use:</p>
  
  <pre><code>ourUrl = "/ajax/poke_dialog.php?uid=uidhere&amp;amp;pokeback=1"
  function httpGet(theUrl)
      {
      var xmlHttp = null;
  
      xmlHttp = new XMLHttpRequest();
      xmlHttp.open( "POST", theUrl, false );
      xmlHttp.send( null );
      return xmlHttp.responseText;
      }
  httpGet(ourUrl);
  </code></pre>
  
  <p>This didn't work either. </p>
  
  <p>I think the problem with the first idea may be that the HTML somehow resets because when I review the source after the script's completion, the ID tag I added is no longer there. (so the click doesn't work? :/)</p>
  
  <p>I was just guessing with the second method so idk why that didn't work. For the record I tried both GET and POST methods.</p>
  
  <p>I am looking for any and all solutions to this.</p>
  
  <p>The only other bit of information I can think of is that this is from the homepage (http://facebook.com) and I <em>think</em> its a different code on different page.</p>