L
L
lavezzi12017-02-24 05:41:27
Django
lavezzi1, 2017-02-24 05:41:27

Where to hide ajax logic?

Hello!

There is a project on django, mostly basic functionality, jquery is used for interactivity. Interactivity lies in the fact that a comment is written, a button is pressed and the comment flies to the page and other similar things. Now all the js code and pieces of html that arrive are stored in the script tag on the page. So the question is, how can this be avoided? After all, you can’t put it in a separate file because all sorts of things like {% for item in items %} from django will not work there.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2017-02-24
@proudmore

Render data from django into variables and then use it in your scripts. The scripts themselves can then be placed in a separate file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question