Rahul Patwa
Rahul Patwa

Reputation: 2489

Retain PHP script variables across multiple AJAX requests to that PHP script

How can I retain variables in PHP script across multiple AJAX calls to that PHP Script ? Would SESSION variable work if I start a session just at the beginning of the script? Or, would each SESSION be destroyed at the end of each AJAX request/script execution ? Will it work if do not manually close the session at the end of the script ?

Upvotes: 0

Views: 633

Answers (1)

chapinkapa
chapinkapa

Reputation: 2673

SESSION should work. Sessions work by adding a unique cookie to the users browser. The session should be maintained as long as you are hitting your server from the same browser.

Upvotes: 3

Related Questions