A
A
Alexander Shendrik2015-06-29 09:57:51
Django
Alexander Shendrik, 2015-06-29 09:57:51

How to send json file to browser using django?

I am writing an anonymous chat, I need to send a message sent by one user without reloading the page, users are naturally not authorized, users have a common chat number. I need the server to send the json file to the user, and js accepts it.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
IvanOne, 2015-06-29
@TheSuperD20

About the server itself sends the data. On the client side, you still have a script that receives data and parses json, so set a timeout of 2 seconds for this script, let it ask the server for data every two seconds
javascript.ru/setTimeout

R
Roman Kitaev, 2015-06-29
@deliro

anonymous chat

It's clear.
Let him send. Let it send JSON instead of HTML, what's the difference? Set a timer on the client side and send requests for new messages.

A
Alexander Taratin, 2015-06-29
@Taraflex

habrahabr.ru/post/128562

A
Alexander Shendrik, 2015-06-29
@TheSuperD20

Note, I'm already using HttpResponse, I need to send a message to the second user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question