I'm developing a feature for adding and removing favorite properties with localstorage.
//Com esse código eu recupero os itens que foram armazenados em um array no localstorage
$(function(){
var favoritos = JSON.parse(localStorage.getItem("favoritos"));
$(favoritos).each(function(i,v) {
$('#favoritos').append("<li>" + v + "</li>");
});
});
The return I get from the favorite variable when I run a document.write
, are the property references separated by (,). Ex: 3174,3304,3205. This is exactly what I need to mount a SQL query (SELECT * FROM imVEL WHERE id_imovel IN ($ favorites)).
How do I turn items retrieved from localstorage into something recognized by php to store these items in a variable (favorite $)?