phingko Posted January 5, 2016 Share Posted January 5, 2016 (edited) My website is working fine until this early week, whenever customers try to add a product, it will come out with this error; Impossible to add the product to the cart. textStatus: 'parsererror' errorThrown: 'SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 3 of the JSON data' responseText: 45b { "products": [ .....} 0 But if I put https://www.domain.com.au instead of www.domain.com.au, the AJAX won't throw any error. There are few speculations I have here, but I have no solutions; what I can think of that there is whitespace I need to delete, but I don't know where. And that the code that I put into my blockcart.php caused it; global $smarty; $smarty->assign('customerDefaultGroup' , Customer::getDefaultGroupId(Context::getContext()->customer->id)); But I tried to comment those out, it still throws me error. SO for now, I disabled the AJAX but customers has started to complain that they are directed to shopping cart every time they add product.And I don't know if this is related, I have random chars on my header every time I access the website.Help Edited January 5, 2016 by phingko (see edit history) Link to comment Share on other sites More sharing options...
im_presto Posted January 5, 2016 Share Posted January 5, 2016 If you are running website on https then you need to make sure all ajax request should also go with https protocol, otherwise it would be seem like cross domain request. Link to comment Share on other sites More sharing options...
phingko Posted January 6, 2016 Author Share Posted January 6, 2016 (edited) Hi presto, thank you for the reply. I managed to direct my homepage to https://www.domain.com.au, but the rest of the page remains as www.domain.com.au And I just realized the error thrown by Firefox and Chrome are different. In Chrome the error is Impossible to add the product to the cart. textStatus: 'parsererror' errorThrown: 'SyntaxError: 'Unexpected token c' responseText: 9ce The responseText are not always the same though. It will throw this random numbers and chars and the alphabet will be picked up as 'unexpected token' Anyone face this problem before? I don't use paypal on my website and I have deactivated google analytic as other posts suggested but none works. Edited January 6, 2016 by phingko (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now