i'm currently struggling with this one, my localstorage key value doesn't update the value when ajax success and remains the old stored data, however it updates only when i press f5 or i refresh the page which is not friendly.
var hide_cat = $('#hide_cat').val();
function fetch_data(){
$.ajax({
url: '../ajax/ajax_fetch_loop.php',
data : {hide_cat : hide_cat},
type: 'post',
cache: false,
success:function(data){
localStorage.setItem('dat', data); /*<-- this one should update new
value every time success,
however its not working, it
remians the old data and i
need to refresh before it
store a new value*/
}
});
}
fetch_data();
function fetch_datas(){
//so after update i should get a new value after ajax success
var table_data = localStorage.getItem('dat');
$('#tboy_labasmo').html(table_data);
}
fetch_datas();