.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>
相关文章:
- Javascript:selenium Web驱动程序isDisplayed()不工作
- jQuery UI自动完成突然停止工作
- AngularJS UI路由器不能像ng路由器那样工作
- HTML5音频加载和播放获胜'我不能在iPad上工作
- JavaScript打印功能使日历停止工作
- Javascript.getHours()工作不正常
- 为什么这在IE中的工作方式与在Firefox中不同
- 视频HTML没有'无法在Internet Explorer 11上工作
- 扩展移相器按钮类不工作
- Firebase迁移-简单的Firebase.set没有'不再工作了——旧的还是新的
- 谷歌地图不是以HTML显示,而是在JS Fiddle上工作
- 正在尝试使用if和else添加类,但无法正常工作
- Jquery FadeIn FadeOut 只工作一次
- Foreach无法在Typescript中工作
- 另一个ajax调用中的Jquery ajax调用在for循环中没有按预期工作
- 为什么不是't窗口.恢复正常工作吗?(javascript/jquery)
- JS可以在Chrome中工作,但不能在Firefox中工作
- ajaxToolkit PopupControlExtender不工作.过时的
- HTML标记在脚本标记中工作
- .load ajax无法正常工作whitin wordpress主题