If you use PHP then it's better to have it output the userID as a variable already inside of JavaScript to save the extra code, or to set it as a cookie, as a matter of fact, if you use Expression Engine, WP or most any other major CMS, there is a cookie already set with that info so you can just pull it from there.
-----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Vik Sent: Sunday, April 19, 2009 3:40 PM To: jQuery (English) Subject: [jQuery] Communicating Info from Server to Javascript, Prior to Ajax Calls? Let's say I want my javascript to know some info, e.g. the username of the user, and I'd like to communicate it prior to any Ajax calls. So far I've been storing the info in a hidden field that jQuery can access via an id. Is this the correct approach? Thanks in advance to all for any info.