Error at the return of an AJAX POST in DJANGO

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Error at the return of an AJAX POST in DJANGO

Walter Randazzo
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/124085ff-0700-4361-9377-02596b161c4fn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

rbar...@xcaretresearch.com
Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Malcolm MacKinnon
In reply to this post by Walter Randazzo
I'm not a JS expert, but is your success function defined properly?
if(e="OK") vs. if(e=="OK")

On Sun, Oct 25, 2020 at 2:06 PM Walter Randazzo <[hidden email]> wrote:

>
> Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.
>
> **This is the error:**
>
> > SyntaxError: Unexpected token O in JSON at position 0
>
> **This is the ajax:**
>
>     $.ajax({
>     headers: { "X-CSRFToken": token },
>     "url": '/articulos/massup/', "type": "POST",
>     "dataType": "json", data: data,
>     success: function(e){
>     if(e="OK"){
>     location.reload(true);
>     }
>     },
>     error: function(a,b,c){
>     alert(c);
>     }
>     });
>     });
>
> **Thi is the view:**
>
>     @csrf_exempt
>     def massup(request):
>         template_name = "articulos/articulos_ok.html"
>         contexto={}
>         if request.method=="GET":
>             cat = Articulos.objects.all().order_by("codigo")
>             contexto={"obj":cat}
>         if request.method=="POST":
>             codigos=request.POST.getlist("codigos[]")
>             porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
>             porcentaje=Decimal(porcentaje)
>             codigos= [int(x) for x in codigos]#Convierte la lista en integer
>             art_change = Articulos.objects.filter(pk__in=codigos)
>             i=0
>             for item in art_change:
>                 if i!=0: #Excluye el primer item ( el porcentaje)
>                     precioant=item.precio
>                     precionuevo=(precioant + (porcentaje * precioant/100))
>                     item.precio=precionuevo
>                     item.save()
>                 i=i+1
>             return HttpResponse("OK")
>         return render(request
>
> --
> 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 [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/124085ff-0700-4361-9377-02596b161c4fn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK8W3Xrftk-3SeGp-EmJVtPzhvWYQp-ZigkHouLOEpDd1W%2B8FA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Walter Randazzo
HI Macolm,

I am checking out  the response value in the  and it shows OK in the browser dev tool . So i guess the function is not defined properly....

image.png

El dom., 25 oct. 2020 a las 18:46, Malcolm MacKinnon (<[hidden email]>) escribió:
I'm not a JS expert, but is your success function defined properly?
if(e="OK") vs. if(e=="OK")

On Sun, Oct 25, 2020 at 2:06 PM Walter Randazzo <[hidden email]> wrote:
>
> Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.
>
> **This is the error:**
>
> > SyntaxError: Unexpected token O in JSON at position 0
>
> **This is the ajax:**
>
>     $.ajax({
>     headers: { "X-CSRFToken": token },
>     "url": '/articulos/massup/', "type": "POST",
>     "dataType": "json", data: data,
>     success: function(e){
>     if(e="OK"){
>     location.reload(true);
>     }
>     },
>     error: function(a,b,c){
>     alert(c);
>     }
>     });
>     });
>
> **Thi is the view:**
>
>     @csrf_exempt
>     def massup(request):
>         template_name = "articulos/articulos_ok.html"
>         contexto={}
>         if request.method=="GET":
>             cat = Articulos.objects.all().order_by("codigo")
>             contexto={"obj":cat}
>         if request.method=="POST":
>             codigos=request.POST.getlist("codigos[]")
>             porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
>             porcentaje=Decimal(porcentaje)
>             codigos= [int(x) for x in codigos]#Convierte la lista en integer
>             art_change = Articulos.objects.filter(pk__in=codigos)
>             i=0
>             for item in art_change:
>                 if i!=0: #Excluye el primer item ( el porcentaje)
>                     precioant=item.precio
>                     precionuevo=(precioant + (porcentaje * precioant/100))
>                     item.precio=precionuevo
>                     item.save()
>                 i=i+1
>             return HttpResponse("OK")
>         return render(request
>
> --
> 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 [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/124085ff-0700-4361-9377-02596b161c4fn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK8W3Xrftk-3SeGp-EmJVtPzhvWYQp-ZigkHouLOEpDd1W%2B8FA%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL7Dry6ofhrTb__NmTdKXK9Pi9ODtzWDX6GVMfRc916WjB9aXw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Walter Randazzo
In reply to this post by rbar...@xcaretresearch.com
hi there,

As far as I check its OK.

Thanks for replay.



El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:
Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL7Dry6VivmQKU9sVwu%3Dhw9QXT35HUT7ySTZkAme3_AVu8Rb4w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Error at the return of an AJAX POST in DJANGO

Trevor Woolley-2

Walter,

 

If your copy and paste is accurate you have too many closing brackets in the ajax section.

 

Try removing one of these from the end of the ajax section:

    });

 

 

From: [hidden email] <[hidden email]> On Behalf Of Walter Randazzo
Sent: Monday, 26 October 2020 9:09 AM
To: [hidden email]
Subject: Re: Error at the return of an AJAX POST in DJANGO

 

[External email] Please be cautious when clicking on any links or attachments.
---

hi there,

As far as I check its OK.

 

Thanks for replay.

 

 

 

El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:

Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:

Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

 

**This is the error:**

 

> SyntaxError: Unexpected token O in JSON at position 0

 

**This is the ajax:**

 

    $.ajax({

    headers: { "X-CSRFToken": token },

    "url": '/articulos/massup/', "type": "POST",

    "dataType": "json", data: data,

    success: function(e){

    if(e="OK"){

    location.reload(true);

    }

    },

    error: function(a,b,c){

    alert(c);

    }

    });

    });

 

**Thi is the view:**

 

    @csrf_exempt

    def massup(request):

        template_name = "articulos/articulos_ok.html"  

        contexto={}  

        if request.method=="GET":  

            cat = Articulos.objects.all().order_by("codigo")  

            contexto={"obj":cat}  

        if request.method=="POST":  

            codigos=request.POST.getlist("codigos[]")

            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje

            porcentaje=Decimal(porcentaje)

            codigos= [int(x) for x in codigos]#Convierte la lista en integer

            art_change = Articulos.objects.filter(pk__in=codigos)

            i=0

            for item in art_change:

                if i!=0: #Excluye el primer item ( el porcentaje)

                    precioant=item.precio

                    precionuevo=(precioant + (porcentaje * precioant/100))

                    item.precio=precionuevo

                    item.save()

                i=i+1

            return HttpResponse("OK")

        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL7Dry6VivmQKU9sVwu%3Dhw9QXT35HUT7ySTZkAme3_AVu8Rb4w%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/SYAPR01MB29126761B62375E2671892A4AF180%40SYAPR01MB2912.ausprd01.prod.outlook.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Walter Randazzo
I tried with no luck. When i remove it  it brings an error.

El domingo, 25 de octubre de 2020 a la(s) 19:19:29 UTC-3, trebor escribió:

Walter,

 

If your copy and paste is accurate you have too many closing brackets in the ajax section.

 

Try removing one of these from the end of the ajax section:

    });

 

 

From: [hidden email] <[hidden email]> On Behalf Of Walter Randazzo
Sent: Monday, 26 October 2020 9:09 AM
To: [hidden email]
Subject: Re: Error at the return of an AJAX POST in DJANGO

 

[External email] Please be cautious when clicking on any links or attachments.
---

hi there,

As far as I check its OK.

 

Thanks for replay.

 

 

 

El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:

Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:

Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

 

**This is the error:**

 

> SyntaxError: Unexpected token O in JSON at position 0

 

**This is the ajax:**

 

    $.ajax({

    headers: { "X-CSRFToken": token },

    "url": '/articulos/massup/', "type": "POST",

    "dataType": "json", data: data,

    success: function(e){

    if(e="OK"){

    location.reload(true);

    }

    },

    error: function(a,b,c){

    alert(c);

    }

    });

    });

 

**Thi is the view:**

 

    @csrf_exempt

    def massup(request):

        template_name = "articulos/articulos_ok.html"  

        contexto={}  

        if request.method=="GET":  

            cat = Articulos.objects.all().order_by("codigo")  

            contexto={"obj":cat}  

        if request.method=="POST":  

            codigos=request.POST.getlist("codigos[]")

            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje

            porcentaje=Decimal(porcentaje)

            codigos= [int(x) for x in codigos]#Convierte la lista en integer

            art_change = Articulos.objects.filter(pk__in=codigos)

            i=0

            for item in art_change:

                if i!=0: #Excluye el primer item ( el porcentaje)

                    precioant=item.precio

                    precionuevo=(precioant + (porcentaje * precioant/100))

                    item.precio=precionuevo

                    item.save()

                i=i+1

            return HttpResponse("OK")

        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a04b3af0-b3a1-4e90-800f-951409ef37d9n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Malcolm MacKinnon
In your success function, you are assigning the variable e = 'OK', so in your if statement, it appears to throw an error. If you change it to  if(e=="OK"), does it work? Note the two equal signs, == .

On Sun, Oct 25, 2020 at 3:29 PM Walter Randazzo <[hidden email]> wrote:
I tried with no luck. When i remove it  it brings an error.

El domingo, 25 de octubre de 2020 a la(s) 19:19:29 UTC-3, trebor escribió:

Walter,

 

If your copy and paste is accurate you have too many closing brackets in the ajax section.

 

Try removing one of these from the end of the ajax section:

    });

 

 

From: [hidden email] <[hidden email]> On Behalf Of Walter Randazzo
Sent: Monday, 26 October 2020 9:09 AM
To: [hidden email]
Subject: Re: Error at the return of an AJAX POST in DJANGO

 

[External email] Please be cautious when clicking on any links or attachments.
---

hi there,

As far as I check its OK.

 

Thanks for replay.

 

 

 

El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:

Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:

Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

 

**This is the error:**

 

> SyntaxError: Unexpected token O in JSON at position 0

 

**This is the ajax:**

 

    $.ajax({

    headers: { "X-CSRFToken": token },

    "url": '/articulos/massup/', "type": "POST",

    "dataType": "json", data: data,

    success: function(e){

    if(e="OK"){

    location.reload(true);

    }

    },

    error: function(a,b,c){

    alert(c);

    }

    });

    });

 

**Thi is the view:**

 

    @csrf_exempt

    def massup(request):

        template_name = "articulos/articulos_ok.html"  

        contexto={}  

        if request.method=="GET":  

            cat = Articulos.objects.all().order_by("codigo")  

            contexto={"obj":cat}  

        if request.method=="POST":  

            codigos=request.POST.getlist("codigos[]")

            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje

            porcentaje=Decimal(porcentaje)

            codigos= [int(x) for x in codigos]#Convierte la lista en integer

            art_change = Articulos.objects.filter(pk__in=codigos)

            i=0

            for item in art_change:

                if i!=0: #Excluye el primer item ( el porcentaje)

                    precioant=item.precio

                    precionuevo=(precioant + (porcentaje * precioant/100))

                    item.precio=precionuevo

                    item.save()

                i=i+1

            return HttpResponse("OK")

        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a04b3af0-b3a1-4e90-800f-951409ef37d9n%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK8W3XooYuvM5R8Z13Oj3KK%2B648MwM7j-qgMTre7UPXB14gupg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Leon Vaks
In reply to this post by Walter Randazzo
  t.f  



Sent from my Samsung Galaxy smartphone.


-------- Original message --------
From: Walter Randazzo <[hidden email]>
Date: 10/25/20 6:10 PM (GMT-05:00)
Subject: Re: Error at the return of an AJAX POST in DJANGO

hi there,

As far as I check its OK.

Thanks for replay.

<img src="https://docs.google.com/uc?export=download&amp;id=0B2naFBGBGbW3cUwtdVJYYUo4bkU&amp;revid=0B2naFBGBGbW3aG9wM3E3TDJ0aE9wMWlOZkcwNnBlRURFZkZJPQ" onmouseover="imageMousePointerUpdate(true)" onmouseout="imageMousePointerUpdate(false)">


El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:
Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL7Dry6VivmQKU9sVwu%3Dhw9QXT35HUT7ySTZkAme3_AVu8Rb4w%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f9618f8.1c69fb81.6f201.01de%40mx.google.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Leon Vaks
In reply to this post by Walter Randazzo




Sent from my Samsung Galaxy smartphone.


-------- Original message --------
From: Walter Randazzo <[hidden email]>
Date: 10/25/20 6:10 PM (GMT-05:00)
Subject: Re: Error at the return of an AJAX POST in DJANGO

hi there,

As far as I check its OK.

Thanks for replay.

<img src="https://docs.google.com/uc?export=download&amp;id=0B2naFBGBGbW3cUwtdVJYYUo4bkU&amp;revid=0B2naFBGBGbW3aG9wM3E3TDJ0aE9wMWlOZkcwNnBlRURFZkZJPQ" onmouseover="imageMousePointerUpdate(true)" onmouseout="imageMousePointerUpdate(false)">


El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:
Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL7Dry6VivmQKU9sVwu%3Dhw9QXT35HUT7ySTZkAme3_AVu8Rb4w%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f9618f9.1c69fb81.6f201.01e1%40mx.google.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Walter Randazzo
In reply to this post by Malcolm MacKinnon
HI Mac,
I've changed the if statement  to if(e=="OK")  but  the message error persist.
Note: I have explore the value of the return in the webbrowser dev tools and it contains "OK"
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAykAAAENCAYAAAALyCpjAAAgAElEQVR4Ae2d7dN1V13f7+kfoG/si44vkEmgJJAQjBRhTAWhFqeltjdoTUAwEx4MdsbISB9mIE0dMjbSgkhopASUBpjqRC0m0hZbRqgTsA7GSjUQMOqLRMC+CuDb3et77nwvftcve++zzln72mufsz975mStvZ7Xb33Ww/esc925cMWVV3V9nyuveFb34quu6a5/zrXdr3/vi7ruZS8r+nz4ur+7yaO8KqOv7G1hb3zjT3Tvete7uh999WvO5H/2Ndd2b33rrZu4t7z1rd1P3vJTG7/Sbyszxl933XU7pY955f+Wm+7uvu0Vt3Xf/v2v3XzkV1hOV/N+02tft+nbzTf/RPeqH3315nPTTa/t7rjjjk34D/7ji1X17WKD22+/vbv22muLPko71u+HH364e9ObfvpJad7xjnd2Dz744Gn4Pfd8qPvkpz51+p7LVPrHHntsk0blqdycRu/33X//5hPj3IaYx2ExXZ9fdSq8r32qS+H6yB/zl5Yf85y33WVftzPbKdpXbVL7FSZ/HKucz2nlxriS/vfZ1OX11a32K4/SxI84cnqF+32o/Jh3yL/LfFEZ0V6xzNjmaB+lie9us8LNXPbH91iuwlt/dl2Tc3t3tXfOr3ftIfHTl2bKsO978d87rU/+KcumrPZMMwaMAQzMz8CFMaM//1nP7n7wmu/sbrr2ud2jL33pVpGiNEqrPMo7VvZY3Pdc972Di30UKt6AlH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VkwFjAAAzAAAzCwTgYQKemAykRY50SI445IgYHIA354gAEYgAEYgIH5Gfj/9h2BGR2t8cIAAAAASUVORK5CYII=" alt="" data-iml="406804.0149999997">

El domingo, 25 de octubre de 2020 a la(s) 21:06:00 UTC-3, Mac escribió:
In your success function, you are assigning the variable e = 'OK', so in your if statement, it appears to throw an error. If you change it to  if(e=="OK"), does it work? Note the two equal signs, == .

On Sun, Oct 25, 2020 at 3:29 PM Walter Randazzo <[hidden email]> wrote:
I tried with no luck. When i remove it  it brings an error.

El domingo, 25 de octubre de 2020 a la(s) 19:19:29 UTC-3, trebor escribió:

Walter,

 

If your copy and paste is accurate you have too many closing brackets in the ajax section.

 

Try removing one of these from the end of the ajax section:

    });

 

 

From: [hidden email] <[hidden email]> On Behalf Of Walter Randazzo
Sent: Monday, 26 October 2020 9:09 AM
To: [hidden email]
Subject: Re: Error at the return of an AJAX POST in DJANGO

 

[External email] Please be cautious when clicking on any links or attachments.
---

hi there,

As far as I check its OK.

 

Thanks for replay.

 

 

 

El dom., 25 oct. 2020 a las 18:43, [hidden email] (<[hidden email]>) escribió:

Not sure, but looks like an extra closing bracket in line 9 of the ajax code

On Sunday, October 25, 2020 at 2:05:28 PM UTC-7 [hidden email] wrote:

Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

 

**This is the error:**

 

> SyntaxError: Unexpected token O in JSON at position 0

 

**This is the ajax:**

 

    $.ajax({

    headers: { "X-CSRFToken": token },

    "url": '/articulos/massup/', "type": "POST",

    "dataType": "json", data: data,

    success: function(e){

    if(e="OK"){

    location.reload(true);

    }

    },

    error: function(a,b,c){

    alert(c);

    }

    });

    });

 

**Thi is the view:**

 

    @csrf_exempt

    def massup(request):

        template_name = "articulos/articulos_ok.html"  

        contexto={}  

        if request.method=="GET":  

            cat = Articulos.objects.all().order_by("codigo")  

            contexto={"obj":cat}  

        if request.method=="POST":  

            codigos=request.POST.getlist("codigos[]")

            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje

            porcentaje=Decimal(porcentaje)

            codigos= [int(x) for x in codigos]#Convierte la lista en integer

            art_change = Articulos.objects.filter(pk__in=codigos)

            i=0

            for item in art_change:

                if i!=0: #Excluye el primer item ( el porcentaje)

                    precioant=item.precio

                    precionuevo=(precioant + (porcentaje * precioant/100))

                    item.precio=precionuevo

                    item.save()

                i=i+1

            return HttpResponse("OK")

        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/91f49db5-e89b-4df2-ab25-9ff61abec4bfn%40googlegroups.com.

--
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 [hidden email].

--
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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6cfde643-9f9b-409e-8ff0-3b25b9dfd66bn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error at the return of an AJAX POST in DJANGO

Nikitha Bangalore Escorts
In reply to this post by Walter Randazzo
hmm


On Monday, October 26, 2020 at 2:35:28 AM UTC+5:30 [hidden email] wrote:
Hi buddies, I have a POST request from ajax. At the backend some records are updated in the django view, this is done fine but an error comes up and the page isnt reloaded.

**This is the error:**

> SyntaxError: Unexpected token O in JSON at position 0

**This is the ajax:**

    $.ajax({
    headers: { "X-CSRFToken": token },
    "url": '/articulos/massup/', "type": "POST",
    "dataType": "json", data: data,
    success: function(e){
    if(e="OK"){
    location.reload(true);
    }
    },
    error: function(a,b,c){
    alert(c);
    }
    });
    });

**Thi is the view:**

    @csrf_exempt
    def massup(request):
        template_name = "articulos/articulos_ok.html"  
        contexto={}  
        if request.method=="GET":  
            cat = Articulos.objects.all().order_by("codigo")  
            contexto={"obj":cat}  
        if request.method=="POST":  
            codigos=request.POST.getlist("codigos[]")
            porcentaje = codigos[0]#el primer elemento de la lista es el porcentaje
            porcentaje=Decimal(porcentaje)
            codigos= [int(x) for x in codigos]#Convierte la lista en integer
            art_change = Articulos.objects.filter(pk__in=codigos)
            i=0
            for item in art_change:
                if i!=0: #Excluye el primer item ( el porcentaje)
                    precioant=item.precio
                    precionuevo=(precioant + (porcentaje * precioant/100))
                    item.precio=precionuevo
                    item.save()
                i=i+1
            return HttpResponse("OK")
        return render(request

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5111b355-45c4-4525-8af9-b726869c46fdn%40googlegroups.com.