Load HTML page dynamically into div with jQuery

后端 未结 7 1421
甜味超标
甜味超标 2020-11-29 02:25

I\'m trying to make it so when I click on a link in a HTML page, it dynamically loads the requested page into a div with jQuery.

How can I do that?

&         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 02:45

    Try with this one:

    $(document).ready(function(){
      $('a').click(function(e){
         e.preventDefault();
         $("#content").load($(this).attr('href'));
      });
    });
    

    and make sure to call this library first:

    
    

提交回复
热议问题