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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmorand
    New Member
    • Sep 2007
    • 219

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

    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******

    [code=javascript]
    function displayResponse (request,func) {
    //alert(request.r eadyState);
    if (request.readyS tate == 4) {
    if (request.status == 200 || request.status == 304) {
    if (request.respon seText.length>0 ){
    init_employee(r equest.response Text,func);
    alert(request.r esponseText);
    }
    else{
    alert("No Employee Found!");
    var emp_answer = confirm("Would you like to create a new employee");
    if(emp_answer== true){
    init_employee(' invalid')
    window.open ("employee_mgmt .cfm","mywindow ",'height=350,w idth=725');
    }
    }
    }
    }
    }
    [/code]

    [code=html]
    <cfquery name="employeeE xists" datasource="Per formance_Eval" dbtype="ODBC">
    select last_name,first _name,dept,titl e,job_code,conv ert(char(10),da te_of_hire,101) as 'date_of_hire'
    from employee
    where emp_id='#URL.em p_id#'
    </cfquery>
    <cfif #employeeExists .RecordCount# neq 0>
    <cfoutput query="employee Exists">#last_n ame#,#first_nam e#,#dept#,#titl e#,#job_code#,# date_of_hire#</cfoutput>
    </cfif>
    [/code]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This is the typical IE caching problem. Make the URL unique to prevent caching, e.g.
    Code:
    url+"?d="+(new Date).getTime()

    Comment

    • dmorand
      New Member
      • Sep 2007
      • 219

      #3
      Originally posted by acoder
      This is the typical IE caching problem. Make the URL unique to prevent caching, e.g.
      Code:
      url+"?d="+(new Date).getTime()
      Cool thanks acoder, let me give this a shot. I can't stand IE, it pisses me off.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Did this work? If not, setting some headers may also solve the problem.

        Comment

        Working...