Results 1 to 3 of 3

Thread: Ajax Tabs and trapping timeout

  1. #1
    Join Date
    Feb 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Ajax Tabs and trapping timeout

    1) Script Title: Ajax Tabs

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tent/index.htm

    3) Describe problem: Is it possible to trap a timeout if a page does not load when the tab is clicked? And in that way tell the user that "we are experiencing problems right now..."

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    By timeout, do you mean the page actually failing to load, or just not load within a certain timeframe? For the former, it's easier to handle. Inside the .js file, try adding the code in red to the existing block below:

    Code:
    ddajaxtabs.loadpage=function(page_request, pageurl, tabinstance){
    	var divId=tabinstance.contentdivid
    	document.getElementById(divId).innerHTML=ddajaxtabssettings.loadstatustext //Display "fetching page message"
    	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
    		document.getElementById(divId).innerHTML=page_request.responseText
    		ddajaxtabs.ajaxpageloadaction(pageurl, tabinstance)
    	}
    	else
    		document.getElementById(divId).innerHTML='<b style="color:red">Error fetching content. Please try again later.</b>'	
    }
    DD Admin

  3. #3
    Join Date
    Feb 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In this way the text show up immediately and if the page load fast just flashes but not really a swell solution...

    Would like to have something that kicks in when/if a page is not loaded.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •