我已經看了所有,似乎只能找到更多的靜態版本(爲缺乏更好的詞)可以通過AJAX調用哪些URL/jQuery的要求:檢測哪個URL從onclick通過AJAX/Jquery加載適當的內容
的Jquery:
$(document.body).ready(function() {
$("li.span3 a").click(function (e) {
$('.content').load(this.href);
e.preventDefault();
});
});
HTML/PHP:
while ($loop->have_posts()) : $loop->the_post();
echo
'<li class="span3 mobile_width"><a href="http://localhost/sites/wp-osprey/?team=jo-bloggs2">';
the_content();
the_title();
echo '</a></li>';
endwhile;
我想它是一個變量,因此它可以聽出了其中的div被點擊後顯示對應g外部html作爲onclick div在while循環中。
我需要在onclick上創建並添加監聽事件,以便抓取正確的外部URL或者是否有其他方法來編寫上述內容?