By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

Issue retrieving data from ajax call to coldfusion page in IE (firefox works fine)

100+
P: 219
I have a page where I'm using ajax to retrieve some employee info when a user clicks a "Retrieve Employee Info" button.

The issue I'm having is that when the user updates the employee info, saves the data, then hits the retrieve employee info button again the data being retrieved is the original data, not the updated data. This only occurs in any IE browser, firefox works fine. In firefox everytime I hit the retrieve employee info button, the correct info is retrieved. It's almost like it's cached the response from the coldfusion page and isn't calling it again.

I am validating the data by using the alert box in the function below.

****This works fine in Firefox******

Expand|Select|Wrap|Line Numbers
  1. function displayResponse(request,func) {
  2.   //alert(request.readyState);
  3.   if (request.readyState == 4) {
  4.     if (request.status == 200 || request.status == 304) {
  5.       if (request.responseText.length>0){
  6.           init_employee(request.responseText,func);
  7.           alert(request.responseText);
  8.       }
  9.       else{
  10.           alert("No Employee Found!");
  11.         var emp_answer = confirm("Would you like to create a new employee");
  12.         if(emp_answer==true){
  13.             init_employee('invalid')
  14.             window.open ("employee_mgmt.cfm","mywindow",'height=350,width=725');
  15.         }
  16.       }
  17.     }
  18.   }
  19. }
  20.  
Expand|Select|Wrap|Line Numbers
  1. <cfquery name="employeeExists" datasource="Performance_Eval" dbtype="ODBC">
  2.     select last_name,first_name,dept,title,job_code,convert(char(10),date_of_hire,101) as 'date_of_hire'
  3.     from employee 
  4.     where emp_id='#URL.emp_id#'
  5. </cfquery>
  6. <cfif #employeeExists.RecordCount# neq 0>
  7.     <cfoutput query="employeeExists">#last_name#,#first_name#,#dept#,#title#,#job_code#,#date_of_hire#</cfoutput>
  8. </cfif>
  9.  
Jul 1 '08 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
This is the typical IE caching problem. Make the URL unique to prevent caching, e.g.
Expand|Select|Wrap|Line Numbers
  1. url+"?d="+(new Date).getTime()
Jul 1 '08 #2

100+
P: 219
This is the typical IE caching problem. Make the URL unique to prevent caching, e.g.
Expand|Select|Wrap|Line Numbers
  1. url+"?d="+(new Date).getTime()
Cool thanks acoder, let me give this a shot. I can't stand IE, it pisses me off.
Jul 2 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Did this work? If not, setting some headers may also solve the problem.
Jul 3 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.