.load ajax无法正常工作whitin wordpress主题


.load ajax not working properly whitin wordpress theme

我试着在Wordpress主题中使用.load函数,我使用的代码以前在HTML主题中测试过,效果很好。

当我在Wordpress主题的js文件中使用它时,它什么都不显示。

有人能告诉我我做错了什么吗?

提前感谢大家

jQuery和.js加载在functions.php 中

function atito_theme_scripts() {
wp_enqueue_style( 'atito-theme-style', get_stylesheet_uri() );
wp_enqueue_script( 'atito-theme-jquery', get_template_directory_uri() . '/js/jquery-2.2.2.min.js', array(), '20130114', true );
wp_enqueue_script( 'atito-theme-atito', get_template_directory_uri() . '/js/atito.js', array(), '20130114', true );
}

atito.js

var auto_refresh = setInterval(
function ()
{
jQuery('#auto').load('load.php').fadeIn("slow");
}, 100); // refresh every 100 milliseconds

HTML

<div id="auto"></div>

装载.php

<p>test ajax</p>

不要在wordpress代码上使用$。仅使用jQuery

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
jQuery('#auto').load('load.php').fadeIn("slow");
}, 100); // refresh every 100 milliseconds
</script>
<div id="auto"></div>