Hi Mayur, For your question - I would suggest you to create a situation like how will you call a function from views.py using ajax from a js file for the same page?
And then you will understand the need of ajax and then will understand how you can get the data from views.py function in a js function. Hope this helps and if you need some more info from my end, let me know. thanks, Gurmeet Kaur On Sun, May 5, 2019 at 1:59 AM Mayur Bagul <[email protected]> wrote: > hi john, > > thanks for help. > i new to django so i dont know how its work and how its syntax is. until > i found resource and learn it. > im not getting your solution but i will search and try to learn it. > > thanking you. > > > On Fri, May 3, 2019 at 9:05 PM John Bagiliko < > [email protected]> wrote: > >> import serializers from django.core >> You can simply use the serializers.serialize method to do this. No need >> to use Restframework. >> >> On Fri, May 3, 2019, 3:25 PM John Bagiliko < >> [email protected]> wrote: >> >>> Dump this result into json and render it on a page. Use AJAX to get this >>> json data in JavaScript. >>> >>> On Fri, May 3, 2019, 2:41 PM sachinbg sachin <[email protected]> >>> wrote: >>> >>>> If u want to use that context in html means for I context ,I.user >>>> name,i.products like that u can use >>>> >>>> On Fri, May 3, 2019, 8:09 PM sachinbg sachin <[email protected] >>>> wrote: >>>> >>>>> In JavaScript I don't know buddy >>>>> >>>>> On Fri, May 3, 2019, 6:33 PM Ravi Kumar <[email protected] wrote: >>>>> >>>>>> Try to use ajax >>>>>> >>>>>> On Fri 3 May, 2019 5:42 pm Mayur Bagul <[email protected] wrote: >>>>>> >>>>>>> Hello community, >>>>>>> >>>>>>> I have stored single value from database inside a variable which is >>>>>>> playing role of context inside views.py function. >>>>>>> >>>>>>> Now I want to use this context(which holds single value) in >>>>>>> JavaScript to change specific HTML content of template which will give >>>>>>> me >>>>>>> desired webpage. >>>>>>> >>>>>>> I Searched on Google but I didn't found any useful tutorial or >>>>>>> solution on specified problem. >>>>>>> >>>>>>> I'm looking forward to get solution from community. >>>>>>> >>>>>>> Thanking you. >>>>>>> >>>>>>> -- >>>>>>> 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 [email protected]. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> 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/37395263-cf1d-4a7d-ad51-911e68da810b%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 [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> 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/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/django-users/CAANT8EFTTjuSXF5U87jX_VDwu6yMZpHN3GcbJ-7zBpTU5YPm2g%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> 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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> 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/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/django-users/CAOs61rwmtrTfUFJFnsq2j5THzy34_x3%3DK_LmX3d51MH_NCmxFA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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/CAC26BE2Qm%2BGPqK0rf%2BMq%3Du7WFua0fLZstfoU89FnLKVY3YjXOQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAC26BE2Qm%2BGPqK0rf%2BMq%3Du7WFua0fLZstfoU89FnLKVY3YjXOQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> 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 [email protected]. > To post to this group, send email to [email protected]. > 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/CAAs559nKY920%2BRkWcmG4piU4X-VjubS0MJMUS%2BNffqYY0_mbNg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAAs559nKY920%2BRkWcmG4piU4X-VjubS0MJMUS%2BNffqYY0_mbNg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To post to this group, send email to [email protected]. 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/CAEbKJVgR53VbvCNp5257tF0UNCnUuk1xOJ%2BMSm3MZYK_i_E6QA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

