weixin_33704234 2015-02-12 22:38 采纳率: 0%
浏览 73

jQuery从FTP请求XML

Can I use JQuery to download a XML file on a FTP server? I want to parse the file size from the XML. Use 2754 as example value.

function getPDBEFileSizeByID(pdbeID) {
    pdbeID = '2754';
    var url = "ftp://ftp.ebi.ac.uk/pub/databases/emdb/structures/EMD-" + pdbeID + "/header/emd-" + pdbeID + ".xml";

    var request = $.get(url);

    request.done(function(response) {
        var xmlDoc = $.parseXML(response);

        $fileSpecs = $(xmlDoc).find('*/map/file');
        var sizeKB = $fileSpecs.attr('sizeKb');

    });
}

Right now I am getting a CORS error. I know what it is of course, but not sure if that's an effect of JQuery or FTP.

EDIT: CORS is only available for HTTP, ok. I must integrate that on the serverside then...

  • 写回答

1条回答 默认 最新

  • weixin_33728708 2015-02-12 22:40
    关注

    CORS is only available for HTTP, ok. I must integrate that on the serverside then...

    评论

报告相同问题?