I have 3 working files :
index.html :
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <script src="urltojquery.js"></script>
 <script type="text/javascript" src="preview.js"></script>
 <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <title>Test Code Preview</title>
 <textarea id="pastecode" rows="20" cols="50" name="pastecode"></textarea>
 <br /><input type="text" id="language" name="language"/>
 <br /><input type="button" onclick="process()" value="Preview"/>
 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
 <div id="previewcode"></div>
preview.php :
PHP Code:
if(!empty($_POST['pastecode']) && !empty($_POST['language']))
$path     '';
$geshi    = new GeSHi($code$language$path);
$geshi->set_overall_style('background-color: #ffffee;'true);
$out $geshi->parse_code();
"<span style=\"color: red\">Nothing to display</span>";
preview.js :
function process(){
    pastecodeVal = $("#pastecode").val();
    languageVal = $("#language").val();
    $("#previewcode").html("Fetching preview..."+"<hr />")

    $.post("preview.php", { pastecode: pastecodeVal, language: languageVal },
             function(data) {

                $("#previewcode").html(data+"<hr />");

As you can see, when the button is pressed, and preview.php os executing, the message "Fetching preview..." is shown.
Instead of that, I'd like to display a loading image when preview.php is getting executed. I've got an image loader.gif in the same folder as the three files. How to do it?