Howdy, I’m back with another silly question, just looking for re-affirmation that what I’m trying to do is not totally ridiculous.
I’m building my portfolio site and I had just learned a bit about ajax and thought I’d play around with using it (though maybe not in a meaningful way as it turns out). So I used it in such a way, that when you click a link on the nav, it loads the contents of that page directly into the index’s main section. For example, clicking contact on the menu will, instead of going to the contact page, load a contact form in between the header and footer of the index already loaded.
Is there any particular reason I shouldn’t be doing this? I’ve followed the rule of graceful degradation, meaning, if JS is not on, the default link still goes to the proper page. The only downside I can see is that I have to effectively have two pages for each section. For instance, Contact.html is the default html link and includes the nav, header, contact form and footer, and then there is the page (contact_main.html) needed for the ajax load, which ONLY has the contact form.
I guess this could have SEO, search index implications possibly but could I just put a rule with robots to tell google which pages to index? In other words, so that contact.html might get indexed instead of the page used for ajax (contact_main.html).
Is this really bad practice to do? And, like, will a potential employer notice it and go, what a stupid way to do things?
Probably the question you might ask is, why would I do it? Well, I figured it’d be fun to play around with learning more ajax at first but then once I did it, I was kind of amazed by how much faster the site felt. The header/nav and footer don’t have to re-load every page and it just felt really snappy and smooth to me.
I recognise it does feel like doing things the hard way but I wondered, since I have graceful JS failure built-in, is there any harm in doing it? Maybe I’m making it out to be more than it is but since I’m new at this and don’t know a lot of common practices and do’s and don’ts, I thought I’d ask. Opinions?