Django Doubt

23 views
Skip to first unread message

Aryan Irani

unread,
May 19, 2022, 2:16:47 PM5/19/22
to Django users
I am currently getting timestamps using javascript as soon as the user types words in the tab. This timestamp is stored in an array.

I want to get that timestamp into my Django template and display it on the screen.

This is my Javascript code 
<script>
const durations = [];
$('#in').keydown(function (e) {
durations.push($.now());
}).keyup(function (e) {
console.log(
['time elapsed:', durations].join(' ')
)
});
</script>

Can someone please help me out. 

Kasper Laudrup

unread,
May 19, 2022, 4:06:46 PM5/19/22
to django...@googlegroups.com
On 19/05/2022 20.11, Aryan Irani wrote:
> I am currently getting timestamps using javascript as soon as the user
> types words in the tab. This timestamp is stored in an array.
>
> I want to get that timestamp into my Django template and display it on
> the screen.
>

This is purely related to front end so no need to think about Django in
this case.

As far as I can tell you simply need to change the call to console.log
to update an element in the HTML of your page using jQuery (which you're
currently using anyway).

Hope this helps you in the right direction.

Kind regards,
Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages