Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-06 Thread Gurmeet Kaur
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 funct

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-04 Thread Mayur Bagul
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 wrote: > import serializers from dj

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-04 Thread Mayur Bagul
hi gurmeet, Thanks for help. as you given solution i didnt learned jason and ajax. so should i learn its syntax and to understand how i can use this inside django? or should i learn specific portion of it. Because when i see provide code from u guys i dint understand how to use it. it will be be

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread Gurmeet Kaur
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=Fals

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread John Bagiliko
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 wrote: > Dump this result into json and render it on a page. Use AJAX to get this > json data in JavaScript. > > On Fri, Ma

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread John Bagiliko
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 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 sachinb

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread sachinbg sachin
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 In JavaScript I don't know buddy > > On Fri, May 3, 2019, 6:33 PM Ravi Kumar >> Try to use ajax >> >> On Fri 3 May, 2019 5:42 pm Mayur Bagul > >>> He

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread sachinbg sachin
In JavaScript I don't know buddy On Fri, May 3, 2019, 6:33 PM Ravi Kumar Try to use ajax > > On Fri 3 May, 2019 5:42 pm Mayur Bagul >> 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

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread Mayur Bagul
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" g

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread Ravi Kumar
Try to use ajax On Fri 3 May, 2019 5:42 pm Mayur Bagul 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

Re: How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread sachinbg sachin
Pass the id in context in Django by default every object has Id On Fri, May 3, 2019, 5:42 PM Mayur Bagul 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 sing

How to pass context value from views.py to getElementById in JavaScript?

2019-05-03 Thread Mayur Bagul
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 Search