Loader Image not working properly javascript

I am working with Javascript(in javascript file), Right now i want to display “loader image”,I want whenever i click on button then “loader image” should display for 20 seconds and then redirect to further next page, Right now “image loader” is displaying but unable to redirect to “other page”, Here is my current code,Where i am wrong ?

jQuery('#double_click_submit').click(function(event) {
    event.preventDefault();
    jQuery('body').html('<img src="https://xxxxxx/wp-content/uploads/2023/04/Loading_icon.gif">'); // showing loader image
                

    jQuery(this).text("Please wait..Image Generating");
    GrabzIt("NjdiMmRiM2RjZWYyNGViMzkzNDA4MDdjZWRlM2RjMGU=").ConvertPage({"target": "#back-ground", "bheight": -1, "height": -1, "width": -1}).Create();
    setTimeout(function() { 
        var screenshot = jQuery("#screenshot img").attr('src');
        jQuery("#main_select_file").val(screenshot);
        jQuery('#wall_form_add').submit();
    }, 20000);