title: How to get redirecting bit.ly shorten url using javascript?
body: <p>I have gotten the shorten url from the long url which is <a href="https://www.jocom.my/" rel="nofollow noreferrer">https://www.jocom.my/</a>. I would like to display the shorten url on current page with javascript when redirected. I have used the window.location.href but it only shows the long url. Can someone help me on this?</p>
  
  <p>code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  $(document).ready(function() {
      var moo = window.location.href;
      $.ajax({
        url: 'api.jocom.com.my/api/url?url=' + moo,
        type: 'POST',
      })
    });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>