Is it possible to transmit PHP session id via ajax and store it with jquery cookie? -


First of all, I'm asking this before making all the code changes necessary to apply it to my website in my application 99% of the data is generated through AJAX, and is sent as JSSN in the form of javascript which is responsible for creating all html content. It works similar to Angular.js, but with a php backend. The session begins only with index.php , and some other session related tasks, such as guest and last minute updates for a logged user and guest / user IP address are updated. / P>

Here's what I want to do:

  1. Get session ID after using it using session_id () to get session ID.
  2. Add it to an array and json encode it.
  3. Decode json with json and manually create / update session ID cookie with jQuery Cookie plugin.

My question is whether PHP session ID will be stored in this case, does PHP still consider the session valid on the request of my Ajax API? I am trying to create an application that is with a static HTML / JS Frontend that fully interacts through this Ajax API. The goal is to present the same four-wheelers, which you meet with Angular.js. Is this possible, and if so, is this advice?

Look no need to set cookies through Json and javascript. PHP and http will do it for you.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -