Created
July 30, 2014 02:41
-
-
Save chukitow/90687050f71e4b6246ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| /* variables */ | |
| var status = $('.status'); | |
| var percent = $('.percent'); | |
| var bar = $('.bar'); | |
| /* submit form with ajax request using jQuery.form plugin */ | |
| $('form').ajaxForm({ | |
| /* set data type json */ | |
| dataType:'json', | |
| /* reset before submitting */ | |
| beforeSend: function() { | |
| status.fadeOut(); | |
| bar.width('0%'); | |
| percent.html('0%'); | |
| }, | |
| /* progress bar call back*/ | |
| uploadProgress: function(event, position, total, percentComplete) { | |
| var pVel = percentComplete + '%'; | |
| bar.width(pVel); | |
| percent.html(pVel); | |
| }, | |
| /* complete call back */ | |
| complete: function(data) { | |
| status.html(data.responseJSON.count + ' Files uploaded!').fadeIn(); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment