I currently have this
destDiv.append("<td><a href="+value.FileLocation+">Download Here</a></td>")
But I actually want to url encode the value.filelocation to my download script getsonginfo.php
If I am understanding your question correctly, all you want to do is the following:
destDiv.append("<td><a href='getsonginfo.php?url="+encodeURIComponent(value.FileLocation)+"'>Download Here</a></td>")
The encodeURIComponent
will handle encoding the value.FileLocation
correctly, and the href needs a '
around it so that it's properly parsed (otherwise the encodeURIComponent
is pointless).
getsonginfo.php?url=
from? 0_ourl=
part was improvisation on my part, but working in PHP that's the most likely construction.FileLocation
can contain user content.
encodeURIComponent
and encode it? developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…