3
I am developing a feature to add and remove 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 references of the buildings separated by (,). Ex:3174,3304,3205. This is exactly what I need to mount an SQL query (SELECT * FROM imveis WHERE id_imovel IN ($favorites)).
How to turn recovered localstorage items into something recognized by php to store these items in a variable($favorites)?
@I can’t understand your answer.
– Igor Silva
@Igorsilva you understand the MVC structure?
– gpupo
@gpudo, yes, layered development.
– Igor Silva
So I’ll try to explain it another way: Layer V collects the favorites list and sends it to C by ajax. Receives from C a JSON that is processed and displayed in V
– gpupo