Solved

data not refreshed

Posted on 2013-05-13
3
323 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

628 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