Mootools AJAX help

Discussion in 'Web Design and Development' started by Ad Pro, May 3, 2009.

  1. Ad Pro macrumors member

    Jul 4, 2007
    Hi, I am have a problem with some Mootools code I am trying to put together.

    The site I am working on (a portfolio type site) has a list of links down the left and a main content area on the right. The content area is populated dynamically via AJAX when the the links are clicked. The main content area needs to display a set of images in tabs which also uses Mootools to work.

    The problem is the tabs do not work, it would appear that the AJAX is not loading the javascript content.

    I am using Mootools request.HTML, the code is as follows:

    window.addEvent('domready', function() {
    req = new Request.HTML({url:'data.html'evalScripts:trueevalResponse:true,
    onSuccess: function(html) {
    onFailure: function() {
    'result').set('text''The request failed.');
    'makeRequest').addEvent('click', function() {
    I hope this makes sense, thanks in advance for any help.
  2. phantax macrumors member

    Feb 2, 2009
    You are going to need to call the functions after the content load with something like this.

    You need to use the onComplete function to run any javascript after the content is loaded, my example function here is update_winheight();

    var req = new Request.HTML({
    	method: 'get',
    	evalScripts: true,
    	update: data_window,
    	onComplete: function() {

Share This Page