2012-02-03 6 views
0

本質的にはロードされたコンテンツのテキストが好きです。私はjquery関数を研究していますが、正しい関数を見つけることはできません。 $ .get()を動作させることができませんでした。既存のdivと読み込まれたスクラップのidは "content"です。 jqueryの:。div内のボックスにコンテンツをロードすると、divを埋め込むのではなく、

$(function() { 
     $('#header a').click(function() { 
      $('#content').empty(); 
      $('#content').load(this.href); 
      return false; 
     }); 
    }); 

HTML:

<div id="header" class="ui-corner-all ui-buttonset"> 
     <a title="index" href="index.php" ><span>home</span></a> 
     <a title="code" href="code.php" ><span>code</span></a> 
     <a title="design" href="design.php" ><span>design</span></a> 
     <a title="illustration" href="illustration.php" ><span>illustration</span></a> 
     <a title="writing" href="writing.php" ><span>writing</span></a> 
     <a title="links" href="links.php" ><span>links</span></a> 
     <a title="about" href="about.php" ><span>about</span></a> 
     </div> 

<div id="contentspace" class="body ui-corner-all"> 
</div> 

ロードされたページ:

<??> 
<div id="content"> 
<title>illustration</title> 
<h2>illustration</h2> 
</div> 
<??> 
+0

を持つべきではありませんが、正確にあなたがやろうとしているしていますか?あなたのマークアップをサーバーに入れれば、助けになるでしょう! –

答えて

1

preexisisting divの両方とロードされたスクラップは、 "コンテンツ" のIDを持っています。

私はよく質問を理解していませんでしたが、あなたは同じid

$(function() { 
$('#header a').click(function() { 
$('#content').empty(); 
    $.get(this.href,function(data){ 
    $("#content").append($(data).wrap("<div class='box'/>")); 
    }); 
    return false; 
}); 
}); 
+0

私はそれらに異なる名前をつけてみます。 – expiredninja

+0

ここで折り返しは何ですか? – expiredninja

+0

'#content' div – Rafay

関連する問題