Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Add to cart button not working - Refused to get unsafe header “X-JSON”
 
BridalHotspot81
Jr. Member
 
Total Posts:  2
Joined:  2013-01-02
 

My \’add to cart\’ button has stopped working all of a sudden. I have no idea why because I haven\’t made any changes. I\’m using Magento version 1.7.

Here\’s a link to my website - http://www.bridalhotspot.co.uk/.

When you click on \’add to cart\’, normally you would get the options \’continue shopping\’ or \’go to cart\’ but for some reason it now only gives the option \’continue shopping\’ without adding the product to the cart.

This is the code in my addtocart.phtml file:

<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__(\'Add to Cart\'); ?>
<?php if($_product->isSaleable()): ?>
<div class=\"add-to-cart\">
<?php if(!$_product->isGrouped()): ?>
<label for=\"qty\"><?php echo $this->__(\'Qty:\') ?></label>
<input type=\"text\" name=\"qty\" id=\"qty\" maxlength=\"12\" value=\"<?php echo $this>getProductDefaultQty() * 1 ?>\” title=\”
<?php echo $this->__(\'Qty\') ?>\” class=\"input- text qty\” />
<?php endif; ?>
<button type=\"button\" title=\"<?php echo $buttonTitle ?>\"class=\"button btn-cart\” onclick=\"productAddToCartForm.submit(this)\"> <span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml(\'\', true, true) ?>
</div>
<?php endif;
?>

I am receiving the following error in my console - Refused to get unsafe header \"X-JSON\" when trying to add to cart.

Refused to get unsafe header \"X-JSON\" prototype.js:1637
Ajax.Request.Class.create.getHeader prototype.js:1637
Ajax.Response.Class.create._getHeaderJSON prototype.js:1714
Ajax.Response.Class.create.initialize prototype.js:1675
klass prototype.js:101
Ajax.Request.Class.create.respondToReadyState prototype.js:1595
Ajax.Request.Class.create.onStateChange prototype.js:1545
(anonymous function)

Have been searching for solutions in Google over a day now so I really hope that someone can help me out! :(

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top