By using a preload comment you are essentially not using AJAX to it's fullest potential. The best way to do this is the following:
Load your page without loading any content with the exception of 1-3 thumbnails.
When a user clicks next or something like that using AJAX load the rest of the content.
Here is the code for an AJAX loader I found somewhere:
<script type="text/javascript">
function ajaxLoader(url,id) {
if (document.getElementById) {
var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.X
}
if (x) {
x.onreadystatechange = function() {
if (x.readyState == 4 && x.status == 200) {
el = document.getElementById(id
el.innerHTML = x.responseText;
}
}
x.open("GET", url, true);
x.send(null);
}
}
//-->
</script>
Also to load the actual page:
<div id="advert">
LOADING...
<script type="text/javascript">
ajaxLoader("adblock.php",'
</script>
</div>
All the actual processing work is done by adblock.php in the background.
Main Topics
Browse All Topics





by: rangasumanPosted on 2006-05-11 at 20:28:37ID: 16664498
The reason AJAX is so hot these days is because it can get information from the server with out reloading the entire page. It definitely has its shortcomings which are not entirely supported like caching etc. Ajax can load images and you dont need to preload them. I would suggest you to make good use of AJAX and not for unnecessary effects in your page. The way to send images through ajax is simply passing the path to the image on your website and the browser will automatically download the image from your server. I would suggest you to go through this tutorial for more information. eloperwork s/xml/libr ary/x- ajax slideshow/
http://www-128.ibm.com/dev