I am trying to make sure the data i got from an ajax is passed onto my view. I actually got success with that but on page refresh the data disappears. Here is my jquery code
$(document).ready(function(){
$('#Item').hide();
$('#submitButton').hide();
$("#cartIcon").click(function(){
var id = $('#id').val();
console.log(id);
$.ajax({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
type: 'POST', // Type of response and matches what we said in the route
url: '/addtocart/', // This is the url we gave in the route
dataType: 'JSON',
data: {'id' : id}, // a JSON object to send back
success: function(response){ // What to do if we succeed
$('#subtotal').html(response.totalPrice);
$('#total').html(response.totalPrice);
$('#Item').show();
$('#noItem').hide();
$('#submitButton').show();
}
});
});
});
How do i make my .html response remain after page reload