title: JSON returns urls twice
body: <p>I have an html table on a page with raws that have 'urls', I'm trying to fetch one url at a time from a random row, however my code returns url as <a href="http://www.test.com/products/product-namehttp://www.test.com/products/product-name.json" rel="nofollow noreferrer">http://www.test.com/products/product-namehttp://www.test.com/products/product-name.json</a>, as you can see it returns url twice, one without json and other with json data, hence I'm getting 404.</p>
  
  <p>I just need the .json URL, not the first part. </p>
  
  <p>How do I get rid of the first url which is not json?</p>
  
  <p>Here's the code.</p>
  
  <pre><code>$(document).ready(function() {
    $(document).on('click', '#closepopup', function() {
      $("#popup").removeClass('popupslidein')
    });
    var tablelink = "https://test.com/pages/product-listing-for-popups.json"; //products url for json data
    $.getJSON(tablelink, function(data) {
      var table = data.page.body_html;
      $('#popuptable').append(table);
      startthepopups()
    });
    var suburbink = "https://test.com/pages/product-listing-suburbs-for-popups"; //suburb names in table rows
    $.getJSON(suburbink, function(data) {
      var suburb = data.page.body_html;
      $('#popupsuburb').append(suburb)
    });
    var namelink = "https://test.com/pages/product-listing-names-for-popups"; //names in table rows
    $.getJSON(namelink, function(data) {
      var name = data.page.body_html;
      $('#popupname').append(name)
    });
  
    function startthepopups() {
      var popupstay = 10000;
      var popuptrigger = 100000;
  
      function triggerpopup() {
        var getrandomtd = Math.floor((Math.random() * $('#popuptable tr').length) + 1);
        var link = $('#popuptable tr:nth-child(' + getrandomtd + ')').text();
        console.log(link);
        var productname = '';
        var getrandomsuburbtd = Math.floor((Math.random() * $('#popupsuburb tr').length) + 1);
        var suburblink = $('#popupsuburb tr:nth-child(' + getrandomsuburbtd + ')').text();
        var getrandomnametd = Math.floor((Math.random() * $('#popupname tr').length) + 1);
        var randomname = $('#popupname tr:nth-child(' + getrandomnametd + ')').text();
        $.getJSON(link + '.json', function(data) {
          productname = data.product.title;
          imagelink = data.product.images[0].src;
          if (!$("#popup").hasClass("popupslidein")) {
            $('#popupsomeone span.name').empty().append(randomname);
            $('#popupsomeone span.location').empty().append(suburblink);
            $('#popupimage').css('background-image', 'url(' + imagelink.split('.jpg')[0] + '_small.jpg)');
            $('#popupproduct a').attr('href', link).empty().append(productname);
            $("#popupagotext").empty().append(Math.round(Math.random() * 15 + 10));
            $("#popup").addClass('popupslidein');
            setTimeout(function() {
              $("#popup").removeClass('popupslidein')
            }, popupstay);
          }
        });
      }(function loop() {
        var random = Math.round(Math.random() * 10) * 100000 + popuptrigger;
        setTimeout(function() {
          triggerpopup();
          loop()
        }, 60000)
      }());
    }
  
  });
  </code></pre>