Let's say I have a Chart demo
class Chart(models.Model):
data = models.TextField()
I store and load data in format of JSON, manipulate data and tries to render a chart on frontend. User case can be:
Chart instancedef chartDetailView(request, pk):
chart = Chart.objects.get(pk=pk)
return render(request, 'chart/chart.html', {'data': chart.data})
There are many website that allows custom JS request, for example, Web: how to redirect to a CodePen or JsFiddle with information filled?.
Since the static page only requires a data context to perform functionality, is there a way I can build an Ajax for javascript to open a new tab for the view?
I mean, to code a view which can be requested by anchor link, form, Ajax or fetch with data passed in by JS, and return a static page. (no Chart instance stored)
Sorry the question may seems ignorant to you, I have learned little about rest framework. I will be very grateful for