Answer the question
In order to leave comments, you need to log in
How to fetch json?
Tell me how to discard unnecessary data received in json?
I am getting full page in json like this
def ArticlesListView(request):
context = {
'articles': Article.objects.get_article()
}
if request.GET.get("mode"):
data = {
"html": render_to_string("articles/list.html", context)
}
}
data = json.dumps(data, ensure_ascii=False).replace('/', r'\/')
return HttpResponse(data, content_type="application/json")
return render(request, "articles/list.html", context)
<div id='json'></div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question