I have embedded a download link for file based on file ID(FID) using a button.But my problem is that when the user presses download button page redirects to downloadfile.php. Instead when the user press download button the page should open in new tab.How can i achieve this?
"download": function(column, row)
{
return '<a href="downloadfile.php?fid='+row["fid"]+'"><button type="button" class="btn btn-info " data-row-id="' + row.fid + '">Download</buttn></a> ';
},
I think i can fix this by adding target='_blank' attribute but when i modify the code as
"download": function(column, row)
{
return '<a target='_blank' href="downloadfile.php?fid='+row["fid"]+'"><button type="button" class="btn btn-info " data-row-id="' + row.fid + '">Download</buttn></a> ';
},
The grid doesnt load.That is because of error.So how to fix this?
There is a typo in this line:-
return '<a target='_blank' href="downloadfile.php?fid='+row["fid"]+'"><button type="button" class="btn btn-info " data-row-id="' + row.fid + '">Download</buttn></a> ';
You are mixing your use of single and double quotes. It should be:-
return '<a target="_blank" href="downloadfile.php?fid='+row["fid"]+'"><button type="button" class="btn btn-info " data-row-id="' + row.fid + '">Download</button></a> ';
Your closing `' tag also contains a typo.