We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24648
    • 20 Posts
    I was wondering how to go about using a full-fledged ajax interface using jquery with dynamic content from modx.

    Basically, what I want to achieve is something like in this tutorial http://www.visionmasterdesigns.com/2008/07/tutorial-ajax-interface-menu-using-jqueryphp/

    Additionally to that, I would like the site to ’build up’ using cool jquery effects when the user enters the site, so that first there’s only an animated logo of the site, then the main menu slides in from the side, then the content slowly fades in, etc. (although I think that’ll be quite easy to do).

    So, I guess I would create the sub-pages (about, contact, whatever,...) in modx containing only a few divs for positioning and a TV storing the content of each sub-page and inside the index.php using the jquery load() function with a few animations to load the sub-pages into index.php? Would I call the sub-pages by loading something like ’index.php?id=14’ or how do I adress them? And would the content from the TVs still be included in the sub-pages, or does modx only do that when the page is called the ’standard’ way (’opening’ the sub-page in the browser via http://www.mysite.com/index.php?id=14)?

    I’m a bit confused about this whole concept since ajax and CMSs (whether it’s modx or typo3 or whatever) seem to do the same thing when it comes to ’navigating’ a site. huh

    Someone please clear this up for me (btw, I don’t need the site to work without javascript, so there’s no need of combining both ways).

    Thank you
      • 7231
      • 4,205 Posts
      You can do this by creating the main page and call the content pages in the same way but rather than boo.php you would use the index.php?id=123. jQuery makes ajax sooo easy.

      The tutorial falls short when it comes time to describe the structure of the content pages but I am guessing that they do not need any template, only the structured content. Also the tutorial (or any other ajax tutorials I have read) does not describe how to deal with the visitor going directly to boo.php (or wherever the ajax content comes from).
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 24648
        • 20 Posts
        Thanks for your reply.

        I am guessing that they do not need any template, only the structured content

        So you mean, I wouldn’t create any templates, nor TVs for the sub-pages and only use the ’blank’ template for those?

        how to deal with the visitor going directly to boo.php

        Well, if I look at the demo from that tutorial, the visitor wouldn’t know the name or adress of the boo.php, would he? Since, if I click any link in the menu, the browser’s adress bar only shows ’http://visionmasterdesigns.com/demo/ajaxinterface/#’
          • 27708 MODX Staff
          • 2,502 Posts
          Yes.

          The using AJAX to load content into a single page is not ideal for user friendliness or ease of navigation and horrible for SEO. Using AJAX to load background data for dropdowns, progressive forms or action interfaces is fine but building out a site using AJAX for the sake of using AJAX is filled with pitfalls and actually makes the user experience less intuitive and breaks conventions.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub