Monday, June 19, 2023

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

With vanilla js

for(let i = 1; i < myArray.length; i += 1) {
    document.log("index: " + i);
    document.log(myArray[i] + "\n");

Wrote this on my phone so may contain some fault, but a for-loop is sufficent. 

On Mon, Jun 19, 2023, 16:29 Lee Stevens <lee@stevensnet.com> wrote:
Helo,

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?

Thanks.

--
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/37febb44-36e2-47ca-9eff-7011c4e9b963n%40googlegroups.com.

--
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/CAPLZMbPghY%2BCAEW6G3T2qC1w7GM5P0TkCZ_XedtANcmbsSmo7w%40mail.gmail.com.

No comments:

Post a Comment