- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › integrating javascript into html – beginner help
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!
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!
Not sure if this is what you are after…
https://css-tricks.com/video-screencasts/85-best-practices-dynamic-content/
It’s a little old but it might be of assistance.
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/