I have a freeform pro form that is using a piece of javascript to provide a progress indicator once a form is submitted. Idea is seen here: http://tympanus.net/Development/ProgressButtonStyles/
However, with this script enabled, the form will not submit. When I comment out the js, the form submits fine. I cannot figure out what I need to edit in the script to play nice with Freeform. Code is as follows:
function initProgressBtn(){
jQuery('.form').each(function() {
var form = jQuery(this);
var sendBtn = form.find('.progress-button');
var ajaxBusy = false;
new ProgressButton( sendBtn.get(0), {
callback : function( instance ) {
var progress = 0,
interval = setInterval( function() {
progress = Math.min( progress + Math.random() * 0.1, 1 );
instance._setProgress( progress );
if( progress === 1 ) {
instance._stop(1);
clearInterval( interval );
}
}, 200 );
form.trigger('startProgress');
}
});
function onSendForm(e) {
e.preventDefault();
if(!ajaxBusy) {
ajaxBusy = true;
jQuery.ajax({
url: form.attr('action'),
type: form.attr('method'),
data: form.serialize(),
dataType: 'text',
success: function() {
}
});
}
}
form.on('submit startProgress', onSendForm);
});
}
Any help would be greatly appreciated - thanks!