AJAX because I Can!

I’m at a record pace this week, with two whole posts. The reason of this post is I added some superflous technology to the site and wanted to share with you. I’ve been reading up on AJAX lately and implemented it in my site. If you don’t know what AJAX is, you will notice when you click on any of the links to the left that lead you to a page that looks like this one, the whole page doesn’t refresh, only the content area does. AJAX allows you to make http requests without reloading the page (which is pretty handy.) One good example of this is the events calender webiste onCurrent. Their nav and content are seperated so you only have to reload the important part of the page.

Now my site is entirely too small for bandwith to really be a concern and I don’t have any dynamic content, so it’s really not nessecary. However, I still wanted to implement it in site, and it does allow me to seperate the rest of my page from all it’s content. I.e. I can update the header or the navBar in one page and it’ll show up on every page thereafter, as opposed to having to make the change on every single page.

This method does have it’s drawbacks though. If a user has javascript disabled they cannot veiw my site. I will have to find a way to send users with javascript turned off to a page where it’s not used. Again that may not be necessary as I’m fairly certain my user-base will all have javascript enabled. But as a saftey measure I think I’ll add a warning.

It’s a fairly simple bit of code if you get it from my scripts directory you can see. I guess the next improvement is to be some dynamic pages, I’m assuming a comments page. So I can at least get some use out of this technology. That’s all for now.

Be Sociable, Share!
This entry was posted in coding. Bookmark the permalink.

Comments are closed.