I know there are plenty of questions and answers about this, here for example, but I cant get it to work in my specific situation. I am trying to pass variables to a view with an ajax call, the start and end dates.
$('input[name="daterange"]').daterangepicker({
opens: 'left'
}, function(start, end, label) {
console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
$.ajax({
type: "POST",
url: "/courses/pageviewsbydate/",
data: {
'start_date' : start,
'end_date' : end,
'csrfmiddlewaretoken' : $("input[name=csrfmiddlewaretoken]").val()
},
success: GA_pagesviewsSuccess.bind(this),
dataType: 'html'
});
console.log("got here");
});