I am trying to prepend an image until something loaded.

I am trying to prepend an image until something loaded.

I have the following code. My prepend is not working. While my images are loading the ajax-loader.gif spinner is not displaying. Is the code syntax right. 

 $(document).ready(function () {
            $(loaderImage).prepend("#book").prepend($('<img src="books/images/ajax-loader.gif", style="position:absolute;left:40%;top:50%;z-index:5000"/>').addClass("ShowLoading"));
            BookID = getParameterByName("bookid"); //Get the query string param that has the book Id 
            CurrentPage = 0; //set the current page to zero 
            $(".Showloading").remove();
        });