在另一个页面中加载所有内容和脚本

时间:2022-12-06 09:34:49

If you go to this page on our website: http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/dahab-divemaster-training.html

如果你访问我们网站的这个页面:http://www.divethegap.com/scuba- diva - programming -dive- gap/dahab-divemaster-training.html

The buttons at the bottom that say 'Beginner' 'Open Water Diver' etc.... They take you to another page where you have a series of options and can book.

底部的按钮说“初学者”“开放水域潜水者”等....他们带你到另一页,在那里你有一系列的选择,可以预订。

We would like it so that rather than have to navigate to another page it loaded those options and all the scripts that make the calculations in a div on the first page. Depending on which button you press depends on which page it would load inside the div.

我们希望它不需要导航到另一个页面,而是在第一页的div中加载这些选项和所有的脚本。取决于您按哪个按钮,取决于它将在div中加载哪个页面。

IFrame does not work as it does not dynamically resize when the collapsible panels are opened. AJAX script at dynamic drive. http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm does not work as none of the collapsible panels work, nor does the calculation script.

IFrame不起作用,因为当折叠面板打开时,它不会动态调整大小。动态驱动器上的AJAX脚本。http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm不能工作,因为所有可折叠面板都不能工作,计算脚本也不能工作。

How can this be done. To sum it up it would be like turning the buttons at the bottom of the page into tabs that would display the content from the pages those buttons currently link through to.

这是怎么做到的呢?综上所述,这就像将页面底部的按钮转换成标签,显示当前按钮链接到的页面的内容。

Is this possible.

这是可能的。

1 个解决方案

#1


4  

Use Jquery, get the data through the $.get() method and use that data to do $('#myDiv').html(data);

使用Jquery,通过$.get()方法获取数据,并使用该数据做$('#myDiv').html(数据);

E.g:

例句:

HTML

HTML

<a href="#" id="getData">Get data</a>
<div id="myContainer"></div>

JS

JS

$('#getData').click(function(){
    $.get('data.php', { section: 'mySection' }, function(data){
       $('#myContainer').html(data);
    });
});

PHP:

PHP:

<?php
    if($_GET['section'] === 'mySection') echo '<span style="font-weigth:bold;">Hello World</span>';
?>

That's the easiest way to do it. If you need any help with $.get() and/or .html() look at here:

这是最简单的方法。如果您需要任何关于$.get()和/或.html()的帮助,请参阅这里:

#1


4  

Use Jquery, get the data through the $.get() method and use that data to do $('#myDiv').html(data);

使用Jquery,通过$.get()方法获取数据,并使用该数据做$('#myDiv').html(数据);

E.g:

例句:

HTML

HTML

<a href="#" id="getData">Get data</a>
<div id="myContainer"></div>

JS

JS

$('#getData').click(function(){
    $.get('data.php', { section: 'mySection' }, function(data){
       $('#myContainer').html(data);
    });
});

PHP:

PHP:

<?php
    if($_GET['section'] === 'mySection') echo '<span style="font-weigth:bold;">Hello World</span>';
?>

That's the easiest way to do it. If you need any help with $.get() and/or .html() look at here:

这是最简单的方法。如果您需要任何关于$.get()和/或.html()的帮助,请参阅这里: