2015-02-07 185 views
0

我有div到index.php(wordpress)。 发送号码到page.php与jquery和返回结果与AJAX到index.php加载直到Ajax加载

我想显示正在加载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> 
+0

我想表现出#target正在加载消息 – 2015-02-07 16:01:05

回答

0
<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>