title: Javascript JIRA Extension not working on hover
body: <p>I have developed some sample of Javascript that creates a JIRA tool tip (using the Tipsy AUI guide - <a href="https://docs.atlassian.com/aui/5.4.0/docs/tooltips.html" rel="nofollow">https://docs.atlassian.com/aui/5.4.0/docs/tooltips.html</a>) of the Ticket status, Summary, Assignee and fixVersion when you hover over an issue-link. Mainly to be used on the issue search page to prevent continuous Right Click -> Open in New Tab -> Check... which becomes extremely tedious, but can also be used for most other issue links.</p>
  
  <p>It is meant to work on hover of a link however it doesn't always go to plan. When I first hover over ANY issue-link, it produces a tooltip 'undefined'. When I hover over ANY issue-link the second time, it then generates the accurate tooltip as expected. Copy it into your console and I'm pretty sure you will see the same behavior.</p>
  
  <p>I'm not a Javascript Guru so it could be the mechanics of Javascript that I am not aware of so if anyone has any idea why this might be happening please let me know!</p>
  
  <p>I have also packaged it into a JIRA plugin and see the same results.</p>
  
  <pre><code>AJS.toInit(function () {
  
  var url,
  issue_id,
  offset,
  x,
  y,
  jira_data,
  html,
  fixVersions,
  assignee,
  domain = document.location;
  
  // build url whatever it might be
  url = domain.protocol +'//'+ domain.hostname
  if (domain.port !== "") {
      url += ':'+domain.port
  }
  
  AJS.$(".issue-link, td.issuelinks &gt; a, #ghx-issues-in-epic-table &gt; tbody &gt; tr &gt; td &gt; a").tooltip({
  
      title: function () {
  
          // GETS THE ISSUE ID FROM THE HREF ELEMENT
          issue_id = (AJS.$(this).attr("href")).slice((AJS.$(this).attr("href")).lastIndexOf("/"), (AJS.$(this).attr("href")).length);
          // QUERIES JIRA API - ALREADY AUTHENTICATED WITH SESSION
          jira_data = AJS.$.getJSON(url+'/rest/api/2/issue' + issue_id, function (json) {
  
          })
              // AJAX COMPLETE FUNCTION
              jira_data.done(function (jira_data) {
              // CHECK FOR FixVersoin and Multiple FixVersions
              fixVersions = ""
              if (jira_data['fields']['fixVersions'] === undefined) {
                  fixVersions = "None";
              } else {
              AJS.$.each(jira_data['fields']['fixVersions'], function(index, value) {
                  fixVersions += value['name'] + " ";
              });};
              // CHECK FOR UNASSIGNED
              if (jira_data['fields']['assignee'] === undefined) {
                  assignee = "Unassigned";
              } else {
                  assignee = jira_data['fields']['assignee']['displayName'];
              };            
              // BUILD STRING OUTPUT
              html = "&lt;span style='text-align:left'&gt;";
              html += "&lt;strong&gt;Status: &lt;/strong&gt;" + jira_data['fields']['status']['name'] + "&lt;/br&gt;"
              html +="&lt;strong&gt;Assignee: &lt;/strong&gt;" + assignee + "&lt;/br&gt;";
              html += "&lt;strong&gt;Fix Version:  &lt;/strong&gt;" +fixVersions+ "&lt;/br&gt;";
              html += "&lt;strong&gt;Summary: &lt;/strong&gt;" + jira_data['fields']['summary'];
              html += "&lt;/span&gt;"
  
          });
          return html;
      }, live: true, gravity: AJS.$.fn.tipsy.autoWE, html:true, delayIn: 400, delayOut: 50});
  
  
          // REMOVE TITLE TAG TO PREVENT OBSTURCTION
  AJS.$(".issue-link, td.issuelinks &gt; a, #ghx-issues-in-epic-table &gt; tbody &gt; tr &gt; td &gt; a").removeAttr('title');    
  AJS.$(".issue-link, td.issuelinks &gt; a, #ghx-issues-in-epic-table &gt; tbody &gt; tr &gt; td &gt; a").parent().removeAttr('title');
  
  });
  </code></pre>