-2

I wish to url encode the value.filelocation so as to have the link the js is producing sends info to my download script.

$(function() {
    $("a.dynamic").click(function(e) {
       e.preventDefault();
       var destDiv = $(this).closest('tr').find('td').last().find('div[id]');
       $.getJSON( this.href, function(obj){
            $.each(obj, function(key, value) {
                destDiv.append("<th>Title</th>")
                destDiv.append("<th>TrackTime</th>")
                destDiv.append("<th>Composer</th>")
                destDiv.append("<th>Lyricist</th>")
                destDiv.append("<th>Song Link</th>")

               destDiv.append("<tr>")
               destDiv.append("<td>"+value.Title+"</td>")
               destDiv.append("<td>"+value.TrackTime+"</td>")
               destDiv.append("<td>"+value.Composer+"</td>")
               destDiv.append("<td>"+value.Lyricist+"</td>") 
               destDiv.append("<td><a href="+value.FileLocation+">Download Here</a></td>") 

               destDiv.append("<tr>");
            });
       });
    });
});
user3075549
  • 55
  • 1
  • 7

1 Answers1

0

The solution seems to be

destDiv.append("<td><a href='getsonginfo.php?url="+encodeURIComponent(value.FileLocation)+"'>Download Here</a></td>")
user3075549
  • 55
  • 1
  • 7