First of all, i'm asking this before i make all of the code changes necessary to implement this in my website. 99% of data in my application is generated via ajax, and transmitted as json back to javascript which is responsible for generating all html content. this works similar to Angular.js but with a php backend. the only thing index.php
does is start the session, and some other session related tasks, like distinguishing a guest and a logged in user and updating the last time seen for the guest/user's ip address.
Here's what i want to do:
- get session id after creating it using
session_id()
to get the session's id. - add it to a an array and json encode it.
- decode the json with javascript and manually create/update the session id cookie with jQuery cookie plugin.
My question is if store the php session id in this matter, will php still treat the session as valid when making requests to my ajax api? I'm attempting to build an application that with a static html/js frontend that interacts entirely through this ajax api. the goal is to offer similar charachteristics and performance of what you get with Angular.js. Is this possible, and if so is this advisable?