View Full Version : How to add a Ajax loading GIF in the ajax content script?
onigetoc
03-28-2007, 01:17 AM
1) Script Title:
2) Script URL (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm):
3) Describe problem: Not really a problem, adding ajax loading images
Any idea, How to add a Ajax loading GIF in the ajax content script?
I tryed reading other .js file on dynamic drive but i din't find out.
Thank you
thetestingsite
03-28-2007, 01:23 AM
Try this. In the javascript that goes in the head of the document, find this function:
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
and replace it with this:
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
document.getElementById(containerid).innerHTML=page_request.responseText
}
else {
document.getElementById(containerid).innerHTML = '<img src="loading.gif"> Loading Content...';
}
}
Change the part in red to your "Loading Message" and the location of the image. Hope this helps.
onigetoc
03-28-2007, 04:16 PM
Working great :)
thank's a lot
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.