Rectangle 27 0

php Applying session to this piece of code?

I have recently implemented this sort of setup: what I did to get around the problem is put the session setting code into the AJAX script and then, in the main/calling script, use that data to generate the content appropriately whenever you navigate back to that page. If you need to do it in a JavaScript script, make this a PHP script and change the content-type to text/javascript (or whatever the MIME type is supposed to be) and then you can set up the JavaScript source dynamically with PHP, just as you would with HTML... While this approach worked just fine, ultimately I went for a purely dynamic JS solution - without session variables - because my setup never required you navigating away from the same page.