Giuliano Mirabella
Giuliano Mirabella

Reputation: 79

What do I do with serialized data from Django in Javascript?

I have a web backend that provides me the info in a json format. For example: the info show in the image,, What I'd like to know is, using Javascript, how can I taje advantage of such data to create the frontend? Typically, I would use return reder from Django, but in this case I am already returning the serialized data! Should I do a fetch from JavaScript? Please any help is very welcome.

Upvotes: 0

Views: 93

Answers (1)

Mukhtor Rasulov
Mukhtor Rasulov

Reputation: 587

In your case, you have to use Django template language to show that data, you can access the data as context instead of making an extra request to Django in javascript.

context = {...} # include your data
return render(request, "example.html", context)

Upvotes: 1

Related Questions