jQuery iframe file upload

前端 未结 5 769
栀梦
栀梦 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:26

    Your form target should be the same as iframe name, for example:

    And after this you can attach event to input button to listen for 'change'. Furthemore you can get progress from server using jsonp and all of this will work in any browser event IE3+. Something like this:

    $('input').change(function () {
        $('form').submit();
    });
    
    $.getJSON('/echo/jsonp/?callback=?', function(e, progress) {
        console.log(progress);
    });
    

提交回复
热议问题