开发者

jQuery Form Plugin with live() in IE

Has anyone had issues when using jQuery form plugin to provide file uploads in conjunction with jQuery live in IE?

It seems to function fine in FF but when trying it in IE, the submit isn't detected at all.

Example code below:

var options = {
    beforeSubmit: showRequest,
    success: showResponse,
    url: 'index.php?module=vacancies&action=upload',
    dataType: 'js开发者_StackOverflow社区on'
};

$('#uploadCvForm').live('submit', function() {
    $(this).ajaxSubmit(options);
    return false;
});

$("#loading").ajaxStart(function(){
    $(this).show();
}).ajaxComplete(function(){
    $(this).hide();
});

function showRequest(formData, jqForm, options) {
    var fileToUploadValue = $('input[name="document"]').fieldValue();
    if (!fileToUploadValue[0]) {
        $('input[name="document"]').addClass('validationError');
            return false;
        }
        return true;
    }
}

function showResponse(data)  {
    if (data.status == 'failed') {

    }
    else {

    }
}


Fixed; I moved the logic that handles the upload to within the dialog onOpen section which allowed me to use .submit() rather than .live('submit', function() ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜