Jump to content

Mootools Help. Request.HTML


jigsawsoul

Recommended Posts

I'm don't have any understanding of JS or Mootools but a friend of mine was helping me create this below. this script basically at the moment, changes what current link is selected and highlights that link. but the html requests are not working, it just gives me a JS pop up book with the test.php text inside. doesn't change the div. any help making it stop the div and change the div on index.php

 

menu.js

var Menu = new Class({

Implements : [Options,Events],

els : [],
current : null,

initialize : function()
{
		this.current = $$( '.current' )[0];
		this.target = $( 'main-content' );
		this.els = $$( '.dyno' );
		this.els.each( function( e )
		{
			e.addEvent( 'click', this.getPage.bind( this ) );
		}.bind( this ));
},

getPage : function( e )
{
	e = e.target;
	this.current.removeClass( 'current' );
	this.current = e;
	this.current.addClass( 'current' );
	if( !e.getProperty( 'href' ) )
	{
		return;
	}
	new Request.HTML({
		onSuccess : function( a, b, c, d )
		{
			this.setContent( c );
		}.bind( this )
	}).get( e.getProperty( 'href' ) );
	return false;
},

setContent : function( e )
{
	alert( this.target.innerHTML );
	this.target.innerHTML = e;
}
})

window.addEvent( 'domready', function()
{
new Menu();
})]

 

test.php

<li> 
				<a href="#" class="nav-top-item">
				Meetings
				</a>
				<ul>
					<li><a class="current dyno" href="_template/test.php">Meetings One</a></li>
					<li><a class="dyno" href="#">Meetings Two</a></li>
					<li><a class="dyno" href="#">Meetings Three</a></li>
				</ul>
			</li>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.