$.ajax({
type: "GET",
url: url,
success: function(response) {
console.log(response);// successfully got the csv,but,,,how can I download???
}
});
I set the csv_view in python server side view.py
def csv_view(request):
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=somefilename.csv'
writer = csv.writer(response)
writer.writerow(['First row', 'Foo', 'Bar', 'Baz'])
writer.writerow(['Second row', 'A', 'B', 'C', '"Testing"', "Here's a quote"])
return response