function createFileItem(fileid, fileUrl) {
    // Get the file name.
    var split_url = fileUrl.split("/");
    var filename = split_url[split_url.length-1];
    // Create row.
    var row = $('<div id="'+fileid+'" class="row file-item">');
    row.append('<a class="filelink" href="'+fileUrl+'" target="_blank"> File: '+filename+'</a>');
    var delfileBtn = $('<button/>', {
        text: 'Delete',
        id: 'del_'+fileid,
        click: function () {
            var is_confirmed = confirm("This file will be removed!");
            if(is_confirmed) {
                $.ajax({
                    url: FileApiUrl+fileid,
                    type: "DELETE",
                    processData:false,
                    contentType: "application/json"
                }).done(function (data, textStatus, jqXHR){
                    $('#file-list #'+fileid).remove();

                }).fail(function (jqXHR, textStatus, errorThrown){
                    console.log ("RECEIVED ERROR: textStatus:",textStatus, ";error:",errorThrown);
                });
            }
        }
    });
    row.append(delfileBtn);
    return row;
}
//Returns a row of file as DIV element.
Returns a row of file as DIV element.
Returns a row of file as DIV element .
function createFileItem(fileid, fileUrl) {
    var split_url = fileUrl.split("/");
    var filename = split_url[split_url.length-1];
    var row = $('<div id="'+fileid+'" class="row file-item">');
    row.append('<a class="filelink" href="'+fileUrl+'" target="_blank"> File: '+filename+'</a>');
    var delfileBtn = $('<button/>', {
        text: 'Delete',
        id: 'del_'+fileid,
        click: function () {
            var is_confirmed = confirm("This file will be removed!");
            if(is_confirmed) {
                $.ajax({
                    url: FileApiUrl+fileid,
                    type: "DELETE",
                    processData:false,
                    contentType: "application/json"
                }).done(function (data, textStatus, jqXHR){
                    $('#file-list #'+fileid).remove();
                }).fail(function (jqXHR, textStatus, errorThrown){
                    console.log ("RECEIVED ERROR: textStatus:",textStatus, ";error:",errorThrown);
                });
            }
        }
    });
    row.append(delfileBtn);
    return row;
}
function createFileItem ( fileid , fileUrl ) { var split_url = fileUrl . split ( "/" ) ; var filename = split_url [ split_url . length - 1 ] ; var row = $ ( '<div id="' + fileid + '" class="row file-item">' ) ; row . append ( '<a class="filelink" href="' + fileUrl + '" target="_blank"> File: ' + filename + '</a>' ) ; var delfileBtn = $ ( '<button/>' , { text : 'Delete' , id : 'del_' + fileid , click : function ( ) { var is_confirmed = confirm ( "This file will be removed!" ) ; if ( is_confirmed ) { $ . ajax ( { url : FileApiUrl + fileid , type : "DELETE" , processData : false , contentType : "application/json" } ) . done ( function ( data , textStatus , jqXHR ) { $ ( '#file-list #' + fileid ) . remove ( ) ; } ) . fail ( function ( jqXHR , textStatus , errorThrown ) { console . log ( "RECEIVED ERROR: textStatus:" , textStatus , ";error:" , errorThrown ) ; } ) ; } } } ) ; row . append ( delfileBtn ) ; return row ; }
Returns a row of file as DIV element.
Returns a row of file as DIV element .
// Get the file name. // Create row.