Hi ,
I have multiple attachments consist of file name and base64 content for each attachment from servlet URL,how can i set all the attachments in HTML table.After clicking on filename i should open that attachment.
How can i do that by using javascript or jquery only.
Here what i have tried
- $.cordys.ajax({
- method: "Getattachmentdetails",
- namespace: "http://schemas.cordys.com/IMSPackage",
- parameters: {
- emailid:mailidvalue
- },
- dataType: '* json',
- success: function (result) {
- output=result;
- bodycontent=output["data"]["body"];
- for(var i=0;i<output["data"]["tuple"].length;i++)
- {
- attname=output["data"]["tuple"][i]["name"];
- base64value=output["data"]["tuple"][i]["base64"];
- }
-
-
- attachmenttable = $('#attachmenttable').DataTable({
- columnDefs: [{
- orderable: false,
- className: 'select-checkbox',
- defaultContent: "",
- targets: 0,
- visible: false
- }, {
- data: attname,
- defaultContent: "",
- targets: 1,
- visible: true
- },
- {
- data: "",
- defaultContent: "",
- targets: 2,
- visible: true
- }, {
- data: base64value,
- defaultContent: "",
- targets: 3,
- visible: true
- }],
- select: {
- style: 'single',
- selector: 'td:first-child'
- },
-
- order: [
- [2, 'asc']
- ],
- "searching": false,
- "retrieve": true,
- "lengthChange": false
- });
- },
- error: function(err){
- console.log(err);
- }
- });
- }