$("#variables #source").attr("id") gives you 'source' result isn't it?you need to get (i think) a textNode of div or custome attribute. But better way, i think, is declare global dict like <script> var params = new Array() params["lang"] = "en"; params["source"] = "somewhere there"; // etc...
$(document).ready(function(){ //other DOM-ready stuff... }); </script> Now you can use `x = params['source']` anywhere - its global. And it disappear when you reload a whole page. But you can't make it visible ;) - use FireBug. On Jan 30, 2008 3:07 PM, Feed <[EMAIL PROTECTED]> wrote: > > Hello all, > > I'd like to know what do you do keep variables across ajax pages. > > I've been doing something that I consider a "hack" and very noobish > (I'm not a programmer): > > I create an invisible DIV in the main page and sub-divs with the > variables, then when I need the values I use attr() to retrieve the > current value. > > Something like this: > > <div id="variables"> > <div id="language">en</div> > <div id="session">clients</div> > <div id="source">digital</div> > </div> > > Then when I need to know where the user came from, for example, I just > do a $("#variables #source").attr("id"). > > I actually find this easy to debug because I can always unhide the > variables DIV. > > Is this extremely noobish? What's the best way to do something like > this? >