Get a button working in a table From JSON Href

    <table class="pull-left table table-fill">
  <thead>
  <tr>
    <th class="table-hover">Name</th>
    <th class="table-hover">Price</th>

</tr>
</thead>
</table>


</body>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script>

      $.ajax({
          type: 'GET',
          crossDomain: true,
          dataType: 'jsonp',
          url: 'api link here',
          success: function (json) {
               //var json = $.parseJSON(data);
               for(var i =0;i < json.results.collection1.length;i++) {
                 var title = json.results.collection1[i].EventsUK.text;
                 var href = json.results.collection1[i].EventsUK.href;
             $("table").append("<tbody><tr><td>"+title+"</td><td>"+href+"</td></tr></tbody>");
           }
     },
     error: function(error){
          console.log(error);
     }
   });
</script>

I receive the href from the website. How would i get the href into a button link? To display in the same place (the table. I have tried adding all the button commands i could to the code which hasnt worked, I have also tried adding it infront he of href and infront of the plus symbols.

Sam

Answers


Links are not resolved by themselves in HTML. You need to use the <a> tag instead. It's very dirty, but the quickest trick to do that, given your code, is changing your append into

$("table").append(""
    + "<tbody>"
    + "<tr>"
    + "<td>" + title + "</td>"
    + "<td><a href=" + href + ">" + href + "</a></td>"
    + "</td>"
    + "</tr>"
    + "</tbody>"
);

... though I don't get the meaning of the table.


Need Your Help

I want to find duplicates in excel on multiple worksheets using Count if function

excel-formula

I am using the following formula to find duplicates on multiple worksheets, but I am getting an error:

Payments in booking system

codeigniter paypal

I am trying to figure out how I can use Paypal to process payments in a booking system I am building. I think Paypal has a very messy documentation, and I can't seem to get a good overview over wha...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.