views:

46

answers:

0

In my application, when /iframe is requested, I create a cookie and serve the iframe.html file. In the html file I use a Javascript Ajax call to request for user data (/user), which is called on $(document).ready and needs to pass the sid from the cookie (so I know the call is authenticated).

The problem is that, the cookie-sid is not passed along with the Ajax get call the first time /iframe is requested (when there is no cookie yet). After reloading, the cookie-sid is passed with the /user call.

Does anyone have any suggestions on fixing the initial load?

I know the browser receives and stores the cookie, then sends it back to the web site every time a new page is requested, but does this also count for initial Ajax calls?