How to make a page load dynamically?

werm82

New Member
Hello all,

What would be the best way to load content dynamically, where the header and possibly the menu do not have to refresh? Similar to this website. Are there any how-to's on this subject? I've realized I have a lot to learn in web design...
 

mburt

New Member
Learn AJAX. You can send information to the server without having to reload a page.

Better yet, if you don't want to go into the details, use the jQuery application. Just include this in your head:
Code:
<script type="text/javascript" src="[b]jQueryFile.js[/b]"></script>

And use the jQuery AJAX code:

Code:
 $.ajax({
   url: "newpage.htm",
   success: function(html) {
     $("#[b]someobject[/b]").html = html;
   }
 });
This will load "newpage.htm" into the "someobject" object.

http://www.jquery.com/
 

jnjc

New Member
I wouldn't worry about this. On each page have you header etc. your browser will cache images and .css etc. so it won't look like you header is loading each time (I pretty sure this is how this page is structured).

If you start using ajax calls you become less search engine friendly and things like the back button and history won't work properly either.

HTH,
JC
 

joe

New Member
it's best to reload the menu's and navigation each time. The browser will cache them (as jnjc states above) so there's no worry about lag time there. If you are intent on dynamic page loading, you can use a javascript function to call xmlhttprequest to go get the information from a php (or whatever your scriping language of choice is) page to send the information back to your function.
 

werm82

New Member
Fantastic! Thanks for the advice. The reason I'm looking to do this is purely aesthetics. Does the script mess up the search crawling a tremendous amount?
 

jnjc

New Member
Fantastic! Thanks for the advice. The reason I'm looking to do this is purely aesthetics. Does the script mess up the search crawling a tremendous amount?

If your concern is loading of the header content, you will have no real aesthetic value using ajax calls. And it will definitely have a negative effect on web crawlers. Also your users won't be able to bookmark particular pages or use the back buttons etc. without you putting in a lot of effort.

In my mind it makes no sense to use Ajax for what you are trying to achieve...
 

werm82

New Member
Well, I can scratch that off my "to-do" list! Thanks for the advice. I'll keep the AJAX in my back pocket for when I find a more appropriate application.
 
Top