I attempted to load content into a div using this tutorial. Unfortunately, the result was that the HTML file loaded as a new page.
Below is the JavaScript code that should have successfully completed the task:
window.addEvent('domready', function() {
$('runAjax').addEvent('click', function(event) {
event.stop();
var req = new Request({
method: 'get',
url: $('runAjax').get('href'),
data: { 'do' : '1' },
onRequest: function() { alert('The request has been made, please wait until it has finished.'); },
onComplete: function(response) { alert('Response received.); $('container').set('html', response); }
}).send();
$('runAjax').removeEvent('click');
});
});
Here is the link that triggers the function:
<a href="about.html" id="runAjax" class="panel">Profile</a>
Finally, this is the div structure of index.html where I intend to load the content into the "container" div:
<div id="view">
<div id="sidebar">
Sidebar Content
</div>
<div id="container">
<div id="logo">
<!--img src="img/logo.png"-->
</div>
<div align="center" id="tagline">
Main Content Body
</div>
</div>
</div>
I am open to using any script that is compatible with MooTools 1.2 for my sliding top panel, as switching to jQuery would require significant additional effort.