Jump to content

JSON Error after upload image


linkref
 Share

Recommended Posts

Hi, 

When I upload an image to a product, i get this error message using chrome.

Unexpected token s in JSON at position 2
 
But using safari i get this one :

JSON Parse error: Unexpected identifier "smushing"
 
I can code, but i don't know where to look...
 
Thanks you for your help..

Share this post


Link to post
Share on other sites

  • 2 months later...

This is basic debugging in Chrome (in other browsers it works quite similar).

Press F12. It will open the DevTools in the lower part of your window.

Assuming that this is an Ajax error you go to the network tab. When you then upload a file you will see the network operations as urls on rights side. See the image:

ajax1.jpg.33d742117cbf3fb6f8b51e2d1f6d4e6b.jpg

Now click the url of the image. You will see then a submenu where you should select Response. See the image:

ajax2.jpg.67f6f18c7d145f2e3e091e1e773a93ab.jpg

When something has gone wrong you will find here an error message. That is what usually results in a JSON or other response error.

Share this post


Link to post
Share on other sites

  • 6 months later...
On 10/31/2017 at 7:18 PM, linkref said:

Hi, 

When I upload an image to a product, i get this error message using chrome.

Unexpected token s in JSON at position 2
 
But using safari i get this one :

JSON Parse error: Unexpected identifier "smushing"
 
I can code, but i don't know where to look...
 
Thanks you for your help..

hello...

 

sorry... have you solved this problem? and do you used prestaspeed module?

Edited by lifeform (see edit history)

Share this post


Link to post
Share on other sites

  • 1 year later...

Here's the issue...

The Ajax call returns an error, the error is written as HTML.

Therefore the first (or other) character is "<" which is not JSON.

In my case, it was an out of memory error.

 

Hope this is more helpful to you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More