Grow your CSS skills. Land your dream job.

integrating javascript into html – beginner help

  • # June 18, 2013 at 5:14 pm

    I’m fairly new to javascript, I should lead off with that.

    The layout of the website I’m building includes a header at the top of the page and a sidebar with nav buttons along the side. What I’m trying to do is that when a nav button is clicked on, it doesn’t direct to a whole new .html file, but just changes the elements within the body section in the same index.html file.

    I know I _could_ just direct the links to new .html files, but I’d really like to do it in javascript instead. Any help would be greatly appreciated. Thanks!

    # June 18, 2013 at 5:23 pm

    AJAX is what you’re looking for. I’m not sure if there are good, free resources available but if you start searching for ‘AJAX tutorials’ I’m sure you’ll find something!

    # June 18, 2013 at 5:24 pm

    Not sure if this is what you are after…

    http://css-tricks.com/video-screencasts/85-best-practices-dynamic-content/

    It’s a little old but it might be of assistance.

    # June 18, 2013 at 5:26 pm

    What you’re looking for is either AJAX loading your pages (AJAX to load new content) or some kind of tabbed navigation (where all the content is already loaded but hidden using JS)

    Using jQuery, both are easy enough even without much JS background. Here are the docs for the [.ajax function](http://api.jquery.com/jQuery.ajax/).

    EDIT: 1) I’m slow, 2) this is even easier: http://api.jquery.com/load/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".