jQuery iframe file upload

前端 未结 5 746
栀梦
栀梦 2020-11-28 07:52

Im building a file upload with jQuery, but Im getting a jQuery error trying to set the attributes of the form:

$(document).ready(function () {
    $(\"#forms         


        
5条回答
  •  渐次进展
    2020-11-28 08:04

    It's not an official plugin, however here's an example on how you could wrap the form's submitting logic into a plugin.

    Example:

    PLUGIN

    !function ($, doc) {
        var _frameCount = 0,
            _callbackOptions = ['done', 'fail', 'always'],
            _hasFailed = function (frame) {
                var frameHtml = $(frame).contents().find('body').html();
    
                return /(server|unexpected)\s+error/i.test(frameHtml);
            },
            _createFrame = function () {
                return $('