php sessions, adding url links to users favourites -
i'm trying design site shows user number of different items, them able add items choose 'view later' page, add favourites. when go page item displayed link take them item viewed. don't want users have sign site therefore can't store selections in database,is there easy way in php. i've been puzzling on last 3 days, appreciated :)
you can store data on computer either cookies or html5 localstorage. see if example helps.
html
<a href="#" class="item" id="item1">item 1</a> <a href="#" class="item" id="item2">item 2</a> <a href="#" class="item" id="item3">item 3</a> js
var vieweditems = []; $(".item").click(function() { vieweditems.push($(this).attr("id")); localstorage['vieweditems'] = json.stringify(vieweditems) console.log($(this).attr("id")); console.log('vieweditems: ', json.parse(localstorage['vieweditems'])); }); you can retrieve array anywhere on site , show user items have "saved" in it. localstorage saved on user's computer it'll accessible there, in browser, , site.
Comments
Post a Comment