0

出力を div に表示したかっただけresult2ですが、出力は action.php?me=1 のままです... ここで間違っているのは何ですか.. URL の問題または何か..出力されますが、このページにはありません..

<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>
<script>
$(document).ready(function(){
   $('a.pop').click(function(e){ 
     $.ajax({
            type: "GET",
            url: this.href,
            success: function(data){
                      $(".result2").append(html);
            }
     });
     return false;
}); 
});
</script>
<body>

<a href="http://ex.com/free/action.php?me=1"  class="member" id="member" rel="example">click to launch</a>
<div id="result2"></div>
</body>
</html>

前もって感謝します...

4

3 に答える 3

1

に変更$(".result2").append(html);$("#result2").append(html);ます。これはクラスではなく ID であるためです

于 2013-04-03T09:28:42.267 に答える
1

クラスではなくIDセレクターを使用してください....クラスセレクターです..一方、#IDです.result2はそのdivのIDです..そして、応答をデータとして命名しています..しかし、そこでhtmlを使用しています...

これを試して

$("#result2").append(html);

ここ

success: function(data){
         $("#result2").append(data);
       // --^---here   //-----^^^^---here your response is as data and not html
}
于 2013-04-03T09:30:04.573 に答える
0
$(document).ready(function(){
   $('a.pop').click(function(e){ 
     $.ajax({
            type: "GET",
            url: this.href,
            success: function(data){
                      // result2 is id, and there is no html but data.
                      $("#result2").append(data);
            }
     });
     return false;
}); 
});
于 2013-04-03T09:30:50.980 に答える