Tuesday, June 20, 2023

Re: Using JavaScript to enumerate a dataset returned to a page.

So it is sounding more and more like I can't just send in a JSON object and then use JSON.parse to loop through the data.  Maybe I am missing something on the django side.  

Parsing on the JavaScript side is easy, but am I creating the variable {{dataset}} in the original message incorrectly?
On Monday, June 19, 2023 at 9:30:15 AM UTC-5 Lee Stevens wrote:

I have a dataset returning to a page.  I need JavaScript to be able to process this.

Instead of using:
{% for item in dataset %}
{{ item.field1 }}
{{ item.field2 }}
{% endfor %}

Is there a JavaScript way to read this dataset/variable instead?


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1e0b39bd-ab66-47c7-845a-3b6795fddb9en%40googlegroups.com.

No comments:

Post a Comment