your user variable is not define try to define it like is not referencing
anything

On Fri, Aug 14, 2020 at 11:07 AM traore arouna <[email protected]> wrote:

> ok my js file is
>
>
> var updateBtns = document.getElementsByClassName('update-cart')
>
> for(var i = 0; i < updateBtns.length; i++)
> {
> updateBtns[i].addEventListener('click',function(){
> var productId = this.dataset.product
> var action = this.dataset.action
> console.log('productId:',productId, 'action:',action )
>
> console.log('USER:', user)
> if(user === 'AnonymousUser')
> {
> console.log('Not logged in')
> }
> else
> {
> updateUserOrder(productId, action)
> }
>
> })
> }
>
> function updateUserOrder(productId, action){
> console.log('User is logged in, sending data..')
> var url = '/update_item/'
> fetch(url, {
> method:'POST',
> headers:{
> 'Content-Type': 'application/json',
> 'X-CSRFToken': csrftoken,
> },
> body:JSON.stringify({'productId': productId , 'action': action})
> })
> .then((response) => {
> return response.json()
> })
> .then((data) => {
> console.log('Data:',data)
> location.reload()
> })
> }
>
> Le dimanche 9 août 2020 à 14:51:03 UTC, [email protected] a écrit :
>
>> I think the error is from the frontend javascript code. Can u share
>> snippets of that code?
>>
>> On Sun, Aug 9, 2020 at 8:30 AM Kovy Jacob <[email protected]> wrote:
>>
>>> Are you switching into your projects directory and then using 'python
>>> manage.py runserver' from command prompt/terminal to run your website?
>>>
>>> On Sat, Aug 8, 2020 at 4:25 PM Agoua David <[email protected]> wrote:
>>>
>>>> Can you send a screenshot of the view file
>>>>
>>>> Le sam. 8 août 2020 à 20:21, traore arouna <[email protected]> a
>>>> écrit :
>>>>
>>>>> Hello
>>>>> I am here because I am developing an e-commerce application.
>>>>> But at a certain level of my code when I run my server with the command
>>>>> python manage runserver
>>>>> I have an error message
>>>>> Uncaught ReferenceError: info is not defined
>>>>>
>>>>> --
>>>>> 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 view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/2fdbf0c6-5f2e-4120-a524-6f3171c50389o%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/2fdbf0c6-5f2e-4120-a524-6f3171c50389o%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAByCr6gT6SJ1EHyDMTGKb6Q73rbRJXWnd7XbgOeq7WE%2BLU3sAg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAByCr6gT6SJ1EHyDMTGKb6Q73rbRJXWnd7XbgOeq7WE%2BLU3sAg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACMwF3U_6LtFunxAm%2BoSjPFuAYyFGQ7QsgctyigqJXCathe8Lw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACMwF3U_6LtFunxAm%2BoSjPFuAYyFGQ7QsgctyigqJXCathe8Lw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/162f2532-e687-42a4-b82f-7b024964a699n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/162f2532-e687-42a4-b82f-7b024964a699n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFujGLys9SU1UkFVpA6_7L1OdWZYxyj%2BXWsyEoVxmgE7PParHQ%40mail.gmail.com.

Reply via email to