I want to create a countdown timer which is integrated with the back-end. I'm using Django. I could have done this in jQuery (so many plugins being available), but I dont how to integrate it with the backend.
I send a list of products from views in the ctx variable {'products':products}
. The format is as follow :-
[
{
price: 9830,
date: "2015-09-06T07:45:41Z",
image: "image.png",
id: 1
},
{
price: 9830,
date: "2015-08-16T07:45:41Z",
image: "image.png",
id: 2
},
....
]
I want to show these products on HTML, here's how I'm doing:-
{% for item in products %}
<div class="item">
<a href="/product/{{item.id}}">
<span class="item-carousel-thumb">
<img class="img-responsive" src="{{product.image}}" alt="img">
</span>
<span class="price"> <i class="fa fa-inr"></i> {{product.price}} </span>
<span class="stop-watch"> Over here I want to show the countdown timer </span>
</a>
</div>
{% endfor %}
In the tag <span class="stop-watch">
, I want to show the countdown timer similar to this. How can I do this?
The countdown timer = Current Time - the time provided in the result.