I am new to jQuery and now, I am currently working on file uploads. And I want to add some progress bar each time I upload image. I used the uploadProgress in jQuery but it seems doesn't work. Here's my code:
$('#_form_').on('submit', function(e){ var file_and_desc = new FormData($(this)[0]), form_url = "_pages/_form_"; var ext = choose.val(), allowed = ['jpg','png']; if(ext){ var get_ext = ext.split('.'); get_ext.reverse(); if($.inArray(get_ext[0].toLowerCase(), allowed) > -1){ //upload image $.ajax({ url : form_url, type: 'POST', data: file_and_desc, contentType: false, processData: false, uploadProgress: function(event, positio, total, percentComplete){ $('h1').html(percentComplete); }, success: function(data){ // some code here... } }); } } }); That's it! What should I do?