-1
我嘗試在我的Wordpress主題中使用.load函數,我使用的代碼先前在HTML主題中進行了測試,並且運行良好。.load ajax無法正常工作whitin wordpress主題
當我在Wordpress主題的js文件中使用它時,它什麼也不顯示。
有人能告訴我我做錯了什麼嗎?
謝謝大家提前
jQuery and .js are loaded in 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>
load.php
<p>test ajax</p>
我已經改變了,但還是沒有結果 – Atito
點擊F12,看看什麼是對網站錯誤。打開頁面並按F12並單擊控制檯部分,您將看到紅色錯誤。寫在這裏是什麼。 –
當我這樣做時,只出現兩個錯誤:** 1)** TypeError:jQuery(...)niceScroll不是函數 atito.js:38:24 ** 2)**將[[Prototype ]]會導致你的代碼運行速度很慢;而是使用Object.create player.js創建具有正確初始[[Prototype]]值的對象:9:28491 – Atito