Where is the order stored?
I am watching a youtube tutorial, he created a function for placing order, but where is it stored? There are the JS function and the view.
function order(){
var msg = note.value;
var orders = localStorage.getItem('orders');
var ur = '/cart/';
var orderData = {};
orderData['orders'] = orders;
orderData['note'] = msg;
$.ajax({
url:ur,
type: "POST",
data: orderData,
success: function(data){
window.location.replace('/success')
localStorage.setItem('orders', JSON.stringify([]));
localStorage.setItem('total', 0);
}
})
}
@csrf_exempt
def cart(request):
request.session.set_expiry(0)
if request.is_ajax():
request.session['note'] = request.POST.get('note')
request.session['order'] = request.POST.get('orders')
return render(request, 'cart.html')