Dynamically load (page3.php) into a div in (page1.php) by a link inside (page2.php) which is previously loaded inside the same div

徘徊边缘 提交于 2019-12-10 11:57:19

问题


I'm able to dynamically call page2.php inside a div in page1.php without page reload by 2 js functions written in the header section of page1.php, but the issue is that after I call page2.php I want to click a link inside it to load page3.php in the same DIV of page1.php instead of page2.php, when I click it I get only (page3.php) in the browser

page1.php:

<head>
<script type='text/javascript'>`
function updateContainer( url ) {`
    dynamicCon = '#dynamicContainer';    
    ObjTag = $( dynamicCon );
    ObjTag.load( url );
}
$( document ).ready( function() {
    $( 'a[data-fancybox-group="dynamicLoad"]' ).bind( "click", function( event ) {
    url = $( this ).attr( 'href' );
    updateContainer( url );
    event.preventDefault();
    event.stopPropagation();
    });
});
</script>
</head>
<body>
<div id="dynamicContainer"></div>
<a href="blabla" onclick="this.href='page2.php'" data-fancybox-group="dynamicLoad">Load Page 2</a>
</body>

page2.php:

<a href="blabla" onclick="this.href='page3.php'" data-fancybox-group="dynamicLoad">Load Page 3</a>

来源:https://stackoverflow.com/questions/16970312/dynamically-load-page3-php-into-a-div-in-page1-php-by-a-link-inside-page2-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!