小编Alv*_*jei的帖子

jQuery load()不会在div中加载脚本标签

页面1具有一个ID为(#navigation)的菜单,该菜单具有一个称为Page2的链接,以及一个具有ID(global_content)的DIV的链接,单击链接Page2时将显示内容。在同一页面(第1页)中,我编写了一个jquery加载函数,因此当我单击链接时,它应显示内容而无需重新加载页面。加载事件工作正常,显示了内容,但没有第2页具有的脚本标签。

这是第1页中的代码

<script>
jQuery(document).ready(function() {

    //jQuery('#navigation li a').click(function(){
    jQuery('#navigation li').on('click', 'a', function(){

    var toLoad = jQuery(this).attr('href')+' #global_content';
    jQuery('#global_content').fadeOut('fast',loadContent);
    jQuery('#load').remove();
    jQuery('#wrapper').append('<span id="load">LOADING...</span>');
    jQuery('#load').fadeIn('normal');
    function loadContent() {
        jQuery('#global_content').load(toLoad, function() {
        jQuery('#global_content').fadeIn('fast', hideLoader());

        });
    }
    function showNewContent() {
        jQuery('#global_content').show('normal',hideLoader());
    }
    function hideLoader() {
        jQuery('#load').fadeOut('normal');
    }
    return false;

    });
}); </script>
Run Code Online (Sandbox Code Playgroud)

这是第2页中的代码

<div id="wall-feed-scripts">

  <script type="text/javascript">

    Wall.runonce.add(function () {

      var feed = new Wall.Feed({
        feed_uid: 'wall_91007',
        enableComposer: 1,
        url_wall: '/widget/index/name/wall.feed',
        last_id: 38,
        subject_guid: '',
        fbpage_id: 0      });

      feed.params = {"mode":"recent","list_id":0,"type":""};

      feed.watcher …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-load

0
推荐指数
1
解决办法
1844
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1

jquery-load ×1