重複の可能性:
コンテンツ内のページ読み込みコンテンツに問題があります
問題があるので、jQueryプラグインが導入されるまで、再印刷する2つのコードは正常に機能しました。まずJavaScript:
$(document).ready(function() {
$.address.crawlable(true).init(function(event) {
$('.nav a').address();
}).change(function(event) {
$('.nav a').each(function() {
$(this).toggleClass('selected', $(this).attr('href') == '#!' + event.value);
});
fragment = event.value.slice(1).replace('!', '');
$('.content').load('http://mysite.com/test/'+fragment+'?ajax=1');
});
});
そして今、PHP:
<?php
$base = 'http://mysite.com/test';
include('data.php');
if ($fragment = $_GET['_escaped_fragment_']) {
// OPTION 1: if Google is reqesting an '_escaped_fragment_=' page, then redirect to a clean URL
header("Location: $base/$fragment", 1, 301);
exit;
}
if ($_GET['url']){
// If there's a URL parameter, then load the data.
$data = loaddata($_GET['url']);
if ($_GET['ajax'] == 1){
// OPTION 2: If the user's browser is requesting just the data (as an AJAX request), that's all we'll return
echo $data;
exit;
}
} else {
$data = '<p>Select a link from above to get started :)</p>';
}
//OPTION 3: a user or bot is requesting an HTML page, and we're return that to them now.
?>
何が起こっているかはここに表示されます:http://laynestaley.co.uk/test/
ページの読み込みが実行され、その後常に何度も起動され、test
インデックスがクラスのdivに読み込まれcontent
ます。
これらの2つのサンプルが一緒に機能しないのはなぜですか?