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

2023-06-20 Thread Prosper Lekia
You can write an Ajax request with Django, and work with the data with
JavaScript in the frontend.

On Mon, Jun 19, 2023, 15:30 Lee Stevens  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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALGeGE2HGSv6G5fZHHG1rNJ7T_YqyjO6V-134zL%2BeT%2BU1bbbrg%40mail.gmail.com.


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

2023-06-20 Thread Lee Stevens
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:

> 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+unsubscr...@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.


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

2023-06-19 Thread Robin Riis
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  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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPLZMbPghY%2BCAEW6G3T2qC1w7GM5P0TkCZ_XedtANcmbsSmo7w%40mail.gmail.com.


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

2023-06-19 Thread ALBERT ASHABA AHEEBWA
Explore using Alpine js. Still learning these bits myself so, I don't have
much detail. But Alpine is what you looking for.



Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

On Mon, 19 Jun 2023, 17:30 Lee Stevens,  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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAQecPeEUJG-K2B-8kDyv5uBW4uVK%3DZv7soGw4kSvgWBBs2yWw%40mail.gmail.com.


Using JavaScript to enumerate a dataset returned to a page.

2023-06-19 Thread Lee Stevens
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+unsubscr...@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.