jquery page load, page keeps getting stuck till the page is fully loaded, instead of displaying the loading gif
<p>I am using the following code to display the loading gif until the page gets loaded. I am not sure if I am doing it correctly. I'm very new to this. </p>

<p>Here is the code:</p>

<pre><code>    $("#hm").click(function(){

$("#response").empty().html('&lt;img src="assets/ajax-loader.gif" /&gt;');
$("#response").load("file.php");
$("#response").hide();
$("#response").fadeIn("slow");

});
</code></pre>

<p>try going to link, like url or my images, the loading gif do get displayed but then gets stuck for a while before the page gets loaded.. </p>

<p>thanks, Please let me know what I am doing wrong.</p>
