PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 25, 2022

[FIXED] What do I do with serialized data from Django in Javascript?

 July 25, 2022     django, javascript, json, serialization     No comments   

Issue

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.


Solution

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)


Answered By - Mukhtor
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing