I am having an issue with my application scope variable not closing when i use jquery ajax to change pages but when i use coldfusion.navigate to change pages the application variable closes fine. does anyone know what would cause this?
what do you mean by ‘closing’?
It does not get deleted. If i use Coldfusion.navigate i am able to create the variable, use it and delete it fine but when i use jquery ajax to change pages the variable is created but if i navigate to another page the variable gets deleted. Does that help?
Application variables are persistant… in other words they’re set in memory for the life of the application.
From what you’re saying a couple of things …
- Are your pages running in a different application from each other maybe?
On every request ColdFusion will look for an Application.cfm or Application.cfc file in the same location as the calling file. If it doesn’t find one it’ll go down a folder level, look there and carry this process on until it finds one.
If the Application.cfm / cfc(s) have different application names then it’s likely that’s why you’re losing variables. The code is switching between these applications.
- Generally the Application scope isn’t used for creating, using and deleting stuff by you. Like I say it tends to be used for loading in variables that aren’t going to change and are applied to all users for the life of that application. i.e. datasource names, directory paths etc.
If you’re looking for temporary storage for a request or for the session of a user then look to use the variables, request and session scopes.
Aside from that I think you’re going to have to give us some code and more specifics of what you’re trying to do, otherwise we’re all just guessing here
Cheers,
James
whoa
didn’t you mean to say up instead of down?
Lol, yeah… I ALWAYS seem to do that.
Was writing that actually and couldn’t mind what ColdFusion does if it can’t find any.
Probably gets in a huge loop, eats the memory, the physical server and moves on to World Domination.
Or along those lines