javascript - Execute code in django as a timed event -
i have message board application needs collect , display messages without user input or action. doing refreshing page using html meta refresh tag. realize not great solution. relevant section want run without refreshing page.
{% if grams_list %} #if there exists messages user {% g in grams_list %} #for each message <h2 class="gram-display">{{ g.message }}</h2> #display message {% endfor %} {% else %} #otherwise display nice picture <h2 id="nograms" class="gram-display">no grams right now.</h2> <img id="bird" src="/static/cardinal_from_pixabay.jpg"> {% endif %}
is sort of thing accomplished javascript? know possible have javascript trigger javascript function every often, possible trigger event? alternately, django have built-in function this? handled signals (i looked @ signals didn't understand them, though looked had potential useful).
django signals can not this. @ jquery.load() (http://api.jquery.com/load/) simplest method similar you're doing (you'll have put template separate url/view).
Comments
Post a Comment