Thanks for that tip, Jack!

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Jack Killpatrick
Sent: Friday, January 09, 2009 10:19 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
.load

 

FWIW, I've never been able to get that to work, either (and I tried quite a few 
times a while ago).
In CF apps I use the http header approach that's been mentioned already 
(because so far all the work
has been for web apps where that's fine and desired), but I also do something 
like this for $.get
and other cases where IE still pisses on my parade:

someting = {

   getSometing: function(someFilePath){
      $.get( someFilePath + '?' + something.noCacheToken(), function(data){
         // do something with the data
      });

   noCacheToken: function(){
       return (new Date()).getTime();
   }

}

- Jack


Rick Faircloth wrote: 

No problem, Josh.
 
I appreciate the help.
 
It seems, however, that the command didn't work.
That may be because the content involved wasn't directly
involved in the ajax transaction, but was content being
manipulated as a result of a successful ajax transaction.
 
I really don't know...
 
Rick
 
  

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Josh Nathanson
Sent: Friday, January 09, 2009 2:41 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to force processing of ColdFusion code when using 
.load
 
 
Sorry, yes it should be cache: false.
 
-- Josh
 
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Friday, January 09, 2009 11:02 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to force processing of ColdFusion code when using
.load
 
 
I tried adding cache: false, to the ajax options, but it seemed
to have no effect.  Should it be "cache=false" or "cache:false".
 
Rick
 
    

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
      

Behalf Of Josh Nathanson
    

Sent: Friday, January 09, 2009 12:07 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to force processing of ColdFusion code when
      

using .load
    

 
I believe this is exactly what jQuery does under the covers when you set
cache=false.
 
-- Josh
 
-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Shawn Grover
Sent: Thursday, January 08, 2009 9:30 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to force processing of ColdFusion code when
      

using
    

.load
 
 
I've seen this caching problem before as well.  I handle it by just
adding a random number to the URL I'm requesting.
 
i.e.
 
$.ajax({
   url: "mypage.cfm?r=" + Math.random(),
   data: myData,
   //. . .
});
 
If you are doing a GET request, the random parameter can go into the
Data then.  The parameter name is arbitrary and is just ignored on the
server side.
 
This essentially forces IE to request a NEW page each time.  It has the
bonus that you don't need any special CF magic (such as adjusting
headers).  But I'd imagine setting the headers is probably better in the
long run.
 
HTH
 
Shawn
 
Carl Von Stetten wrote:
      

Rick,
 
I've had problems in the past with IE using the cached version of AJAX
content instead of reloading it.  The solution that generally works is
to add this to the top of the .cfm page your are loading via AJAX:
 
<cfheader name="expires" value="#now()#">
<cfheader name="pragma" value="no-cache">
<cfheader name="cache-control" value="no-cache, no-store, must-
revalidate">
<Your CF code here...
 
See if that helps.
Carl
 
On Jan 8, 5:08 pm, "Rick Faircloth"  <mailto:r...@whitestonemedia.com> 
<r...@whitestonemedia.com>
wrote:
        

Hi, Carl...and thanks for the reply.
 
Yes, the conditional statements are in the include_menu_index.cfm file.
 
They determine the menu like so:
 
                <cfif isdefined("session.announcements") and
          

session.announcements eq 1>
      

                        <li><a
          

href="cfm/announcements.cfm">Announcements</a></li>
      

                </cfif>
 
                <cfif isdefined("session.res_announcements") and
          

session.res_announcements eq 1>
      

                        <li><a href="cfm/res_announcements.cfm">RES
          

Announcements</a></li>
      

                </cfif>
 
etc....
 
FF3 does re-process the CF.  IE doesn't.  I confirmed that by putting
          

this code
      

at the top of the include_menu_index.cfm file:
 
<cfset greeting = "Hi, Rick" />
<cfoutput>greeting = #greeting#</cfoutput>
 
Next, I logged out, clearing the session variables, then logged back in
and got "greeting = Hi, Rick" at the top of the menu.
 
Then, before logging in as another user with different access to menu
          

items, and
      

therefore a different menu structure, I changed "Rick" to "Bob" and
          

saved
    

the
      

include_menu_index.cfm file.
 
I logged in as the new user, and sure enough, I got "greeting = Hi,
          

Rick"
    

instead
      

of what was actually in the template, "greeting = Hi, Bob".
 
Only when I refreshed the page did I get the correct greeting,
          

"greeting
    

= Hi, Bob".
      

I've tried everything to try and figure out a way to get IE to
          

re-render
    

the menu,
      

but everything I've tried has failed.
 
I think I may have to use the cfc that processes the user's credentials
          

to create
      

the appropriate menu and save that content as plain HTML, then load
          

that
    

with jQuery.
      

The loading seems to work with plain HTML, but without re-freshing,
          

processing of
      

code doesn't run.
 
Thoughts?
 
Rick
 
          

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]
            

On
    

Behalf Of Carl Von Stetten
      

Sent: Thursday, January 08, 2009 5:13 PM
To: jQuery (English)
Subject: [jQuery] Re: How to force processing of ColdFusion code when
            

using .load
      

Rick,
Is the ColdFusion conditional code in the includes/
include_menu_index.cfm file?
If so, there may be issues with the AJAX request not using the same
ColdFusion session as your main page.
Also, you might check your AJAX response using Fiddler with IE and
compare it to the response in Firefox using Firebug.
HTH,
Carl
On Jan 8, 3:04 pm, "Rick Faircloth"  <mailto:r...@whitestonemedia.com> 
<r...@whitestonemedia.com>
wrote:
            

How can I force the processing of ColdFusion code in a menu
segment when I have some login and I replace the menu HTML.
I had some conditional code like:
                <cfif isdefined("session.announcements") and
              

session.announcements eq 1>
      

                        <li><a
              

href="cfm/announcements.cfm">Announcements</a></li>
      

                </cfif>
                <cfif isdefined("session.res_announcements") and
              

session.res_announcements eq 1>
      

                        <li><a href="cfm/res_announcements.cfm">RES
              

Announcements</a></li>
      

                </cfif>
This code displays menu items only if the user has clearance
to access those sections in a site manager.
The problem I have is the IE (seems to be working fine in FF3)
is not processing the CF code unless I do a full page refresh...then
              

it
    

displays the menu appropriately.
Here's the jQuery...any idea how to force IE to reprocess the CF,
              

too?
    

$.ajax({
     type: "POST",
     url:  "login/login_processor.cfm",
     dataType: "json",
     data: formval,
     success: function(response){
           if (response.login == "Login Successful")
              { $('#logstatus').empty().append("Log Out");
                $('#menu').hide();
 
                

$('#menu').load("includes/include_menu_index.cfm").show();
      

           tb_remove() }
                

 
 
 
  

 

Reply via email to