tags:

views:

46

answers:

1

If you go to this page on our website: http://www.divethegap.com/scuba-diving-programmes-dive-the-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.

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.

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.

+4  A: 

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

E.g:

HTML

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

JS

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

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:

Ben
all looks good. I'll give a try tomorrow. Many Thanks
Robin I Knight
Very Unnexpexcted Results, I don't know where to start. Have a look for yourself.http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/programme-pages/dahab-divemaster/divemaster-trainingA.php
Robin I Knight
You have this '<script type="text/javascript"> function loadtest() { $.get("test.php"); </script> ' and '<a href="#" id="getData" onclick="return false">Get data</a> ', that's not what i posted up there. Also, you're including Jquery 1.2.2 and 1.2.3 on the same page, try using just using 1.4.2.
Ben
Thanks for getting back Ben.Everything is exactly as written above now with jquery 1.4.2. As you can see http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/programme-pages/dahab-divemaster/divemaster-trainingA.php , the same problem is still going on. One alternative I can think of is that the entire page reloads and then snaps to an internal link, but that is rather clumsy by comparison. Any ideas as to what is going on. It clearly is finding the page test.php and loading it (to some extent) so the principle works, but the end result is very odd. MANY THANKS FOR ANY HELP
Robin I Knight