Remote Session Exisit?

If I invoke a remote CFC/CFM from JQuery using AJAX ($.get), do the session variables still exisit for the caller?  It's a little hard to test.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

_agx_Connect With a Mentor Commented:
Yes, there shouldn't be a difference. You're still calling the page from a browser, so the normal rules for sessions still apply.

     >  It's a little hard to test.

Create a cfc that returns info about the session (ie id and some variable) then call it from a test page.

Test Component:
   <cffunction name="testSession" access="remote" returnType="string">
            <cfargument name="arg" type="string" />
            <cfif not structKeyExists(session, "userName")>
                  <cfset session.userName = "bob"& randRange(1, 1000)>
            <cfreturn "Session: "& session.sessionid &" userName="& session.userName &" called at "& now() />

Test Page:
<script src="" type="text/javascript">/script>
<script type="text/javascript">
      function test() {
            $.get('http://localhost/path/someComponent.cfc?method=testSession&arg='+ Math.random(), function(data) {
<div class="result"></div>
<a href="javascript:test()">Test</a>
gdemariaConnect With a Mentor Commented:
Yes they do.  The session is kept alive through cookies which the cfc/m has available even through ajax
{Sigh} ... EE really needs ajax notifications...
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

hefterrAuthor Commented:
{Sigh} ... EE really needs ajax notifications...

What do you mean by this?
hefterrAuthor Commented:
@hefterr - Nothing to do with your question, just 2 responses colliding ie saying the same thing at the same time... EE should have some sort of ajax notification to let you know new comments were posted while you were composing an answer. So you can edit/cancel your response if someone else already said some of the same things. Currently you don't know unless you refresh the page .. and you have to do it in a new tab/window so you don't lose the answer you're composing. Seems like a perfect job for ajax.
All Courses

From novice to tech pro — start learning today.