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
https://forums.phpfreaks.com/topic/188725-mootools-help-requesthtml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.