Mark
Mark

Reputation: 263

How to add values to a php session with jquery

I have an audio player and I want to send the time when I access another link, so when it's loaded it can continue from the exact time I pass in the session any help?

Upvotes: 0

Views: 140

Answers (2)

adeneo
adeneo

Reputation: 318232

Why would you need to use PHP sessions for this?

I'd use a cookie, or if older browsers are'nt an issue, local storage, or maybe a script for using cookies on older browsers and local storage on newer browsers.

There's a handy cookie plugin for jQuery.

Local storage is pretty straight forward aswell:

localStorage.setItem('timeIleft', time_variable);

and to retrieve:

var user_left = localStorage.getItem('timeIleft');

Upvotes: 1

sdespont
sdespont

Reputation: 14025

You need to call an AJAX requets to do that.

The URL will be a php page and will retrieve your data using $_POST['param-name'].

Or, check this way to call php page http://www.xajaxproject.org/

Upvotes: 0

Related Questions