$(document).ready(function(){
    $(document).on('click','.submit_button', function(){
        var $btn = $(this);
        $btn.parents('form').submit();
        setTimeout(function () {
            $btn.css({'background-image': 'url(/static/images/preloading.png)'})
                .animate(
                    {backgroundPositionX: "-400px"}, 10000, 'linear',
                    function(){ $(this).css({'background-image': 'none', 'background-position-x':'0px'}); }
                );
        }, 15);
    });
});
