Solved

data not refreshed

Posted on 2013-05-13
3
314 Views
Last Modified: 2013-05-14
I have a page that, on $(document).ready calls on ASP page to "draw" a previously completed survey (checkboxes and textboxes). The user can then make changes and return back to a 'summary' page by:  window.location.href

When they click in the summary to go back to the detail, the data that shows is what was originally entered, not the latest data.  It is not until I completely close the browser, re-open the summary, and click to the detail that I see the saved changes.  It is as if the first one is saved in cache???

When clicking on the link on the summary page, I tried adding a random number to the url  but that didn't seem to fix it:  http://forum.jquery.com/topic/force-page-update
0
Comment
Question by:KCTechNet
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39163572
I have a page that, on $(document).ready calls on ASP page to "draw" a previously

If that mean you're using ajax, set cache:false
check it in the settings list here : http://api.jquery.com/jQuery.ajax/
0
 

Author Comment

by:KCTechNet
ID: 39165016
After reading more about cache, I realized that it was the data load that pulling from cache, the the survey page itself.

So, I incorporated your suggestion and moved the random number to the getJSON url.  I guess overkill but I had seen a post from someone where they said the cache would stop working after a few page loads and I can't have that happening:

        var randomnumber=Math.floor(Math.random()*100000);
        $.ajaxSetup({ cache: false });
        $.getJSON( 'DynamicReturn.asp?rn='+ randomnumber,    {proc:"GetPMSurveyResponses",params: varParams}, function (data) { 

Open in new window


Thank you for your time.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39165144
moved the random number to the getJSON url

this is what cache:false do

Math.floor(Math.random()*100000);
if you're very unlucky you can get two times the same number
I prefer :
new Date().getTime()
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now