I have done this in my project. We converted the object ( or context
object) that you want to pass in list object in python function and then
casted it with Json response object.

Something like below:

 myqueryset_new = list(myqueryset1)
    finalmyqueryset = JsonResponse(myqueryset_new, safe=False)
    return finalmyqueryset

and this finalmyqueryset object will come in data when you will try to call
this view.py function using ajax.

Let me know if it works for you.

On Fri, May 3, 2019 at 10:41 AM Mayur Bagul <mayur.bag...@gmail.com> wrote:

> I don't want to anything in context because I already passing value of
> database inside it.
>
> What I want that how I can pass that context to JavaScript
> getElementById().innerHTML='context'
>
> Like this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/44fca221-7061-4af7-822d-914778eb7f20%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEbKJVg9sUvSY8fJ6-6Eb3D9TUuSpf-d1PtO92sMCwytmPVKGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to