Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Accordion Script that reloads secondary page each time.

  1. #1
    Join Date
    Dec 2012
    Location
    Doncaster
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Accordion Script that reloads secondary page each time.

    1) Script Title: :: Accordion Content script (v2.0)

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

    3) Describe problem:

    I have implemented the script on a request page. when the request is clicked on, it drops down an additional page with more information, (using the "hiddenajaxlink" method) this works perfectly.

    As described in the script instructions. the ajax call for the secondary page only loads the raw data on the first call then subsequently uses cached data. is there anyway to force the script to load fresh data each time. The information it is loading changes throughout the day so it has to be loaded fresh each time to be sure we are showing the most up-to-date information to our users.

    Or is there another script that would allow me to do the same thing.

    Thanks

    Michael Kennedy
    IT Manager
    Last edited by motorhog; 12-31-2012 at 04:16 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I'm just guessing here, but open up ddaccordion.js and delete the following line (you can find it using CTRL+F).
    Code:
    ajaxinfo.status="loading" //set ajax status to "loading"
    Last edited by Nile; 12-30-2012 at 08:40 PM.

  3. #3
    Join Date
    Dec 2012
    Location
    Doncaster
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    I'm just guessing here, but open up ddaccordion.js and delete the following line (you can find it using CTRL+F).
    Code:
    ajaxinfo.status="loading" //set ajax status to "loading"
    Thanks Nile, but that didn't work. I tried the same thing with a couple of other lines that looked like they might be what i was looking for but they also did nothing.

    Code:
    ajaxinfo.cacheddata=content //remember ajax content
    ajaxinfo.status="cached" //set ajax status to cached
    any other ideas??

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,933
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    9

    Default

    What if you change the "cached" part of that second line to "none"?
    Code:
    ajaxinfo.status="none" //set ajax status to cached
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  5. #5
    Join Date
    Dec 2012
    Location
    Doncaster
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Have tried that, and in several other places. all it seems to do is A. Nothing or B. just shows the loading... text

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,933
    Thanks
    16
    Thanked 303 Times in 302 Posts
    Blog Entries
    9

    Default

    I can't really test much from iPhone but the demo page appears to null the cache on page refresh (so I'm surmising from the loading image before the content loads again) so presumably if you refresh the page and trigger the header, the revised Ajax file will load in too. So what if you employ the URL + parameter mechanism that does that (as used on the demo's plain text links), in the actual headers themselves?
    Code:
    <a href="currentpage.htm?mypets=2">Reload page and select the 3rd content using a URL parameter</a>
    Its a refresh + reload file + expand content, all in one go - Would that work for you?
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  7. #7
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Sorry about the troubles. I was able to look through the file, so this should do the trick if I'm not mistaken. Restore to the original file and delete the following line (line 60, for clarification).
    Code:
    ajaxinfo.status="cached"
    That should do it
    Last edited by Nile; 12-30-2012 at 11:18 PM.

  8. #8
    Join Date
    Dec 2012
    Location
    Doncaster
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    That function seems to be for the Last example which has the additional content in a <div> rather than calling it from an external url.

    When i refresh the screen it doesn't clear the cache that the ajax script/calls are using. i have to completely close the browser for it to reload and display any changes made to the additional info files.

    I think is is something in the ddaccordion.js file but just not sure. there are lots of if statement relating to content and ajax but in all honesty Javascript and ajax are a bit alien.

    Thanks

  9. #9
    Join Date
    Dec 2012
    Location
    Doncaster
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Nile View Post
    Sorry about the troubles. I was able to look through the file, so this should do the trick if I'm not mistaken. Restore to the original file and delete the following line (line 60, for clarification).
    Code:
    ajaxinfo.status="cached"
    That should do it
    Hi Nile, i had tried that earlier and it didnt have any effect. I have re-tried it and still does not reload the file.

  10. #10
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    That's odd. I'm going to set this up locally and give it a try. In the meantime, restore to default and find the following lines (94-100):
    Code:
    if (ajaxinfo.status=="none" || ajaxinfo.status=="loading")
    	this.ajaxloadcontent($targetHeader, $targetContent, config, function(){ddaccordion.expandit($targetHeader, $targetContent, config, useractivated, directclick)})
    else if (ajaxinfo.status=="cached"){
    	$targetContent.html(ajaxinfo.cacheddata)
    	ajaxinfo.cacheddata=null
    	ajaxinfo.status="complete"
    }
    And replace them with
    Code:
    if (ajaxinfo.status=="none" || ajaxinfo.status=="loading" || ajaxinfo.status=="cached") {
    	ajaxinfo.status = "none";
    	this.ajaxloadcontent($targetHeader, $targetContent, config, function(){ddaccordion.expandit($targetHeader, $targetContent, config, useractivated, directclick)})
    }
    To see if that works
    Last edited by Nile; 12-30-2012 at 11:37 PM.

Similar Threads

  1. Previous posts link reloads current page.
    By danielmeade in forum PHP
    Replies: 1
    Last Post: 11-14-2010, 02:25 PM
  2. Blank Page in Local Time script
    By yaraco in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 04-24-2010, 02:21 PM
  3. Resolved When Page reloads the it does not go back to selected tab
    By dragon9976 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 06-23-2009, 12:16 AM
  4. Replies: 1
    Last Post: 07-30-2008, 05:30 PM

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
  •