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 %}

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?

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

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

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