加载直到 Ajax 加载

Loading until Ajax Load

我已经 div 进入 index.php (wordpress)。 使用 jquery 将数字发送到 page.php,将 return 结果使用 ajax 发送到 index.php

我想在 Div 中显示正在加载(或文本或图像)直到 Ajax 加载。

这是我的代码:

<script>
myfunc = function()
{           
    $("#target").slideUp(400);
    $("#target").slideDown(400,"swing",function()
        {                           
            splittedURL=window.location.href.split("#");
            $.post('<?php bloginfo('template_directory'); ?>/page.php','state='+splittedURL[1],function(data,status)
            {
                $("#target").html(data);
            })      
        }
    );                          
}
</script>
<script>
myfunc = function()
{   
    $('#target').html("my html here");
    $("#target").slideUp(400);
    $("#target").slideDown(400,"swing",function()
        {                           
            splittedURL=window.location.href.split("#");
            $.post('<?php bloginfo('template_directory'); ?>/page.php','state='+splittedURL[1],function(data,status)
            {
                $("#target").html(data);
            })      
        }
    );                          
}
</script>