Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Paleo To Me commented on AJAX POST /cart/add.js Functions but returns Syntax Error

$
0
0

Nate:

Thanks. I actually thought of that too. Took me a few days to remember that I could use Firebug to view the full call and response.

The problem is actually in the documentation example, which I just copied to be consistent:

jQuery.post(
  cartAjaxUrl, 
  {
    quantity: quantity,
    id: variantID
  }
)

According to jQuery's documentation, jQuery.post defaults to trying to interpret the response (http://api.jquery.com/jQuery.post/), but it seems like jQuery wasn't determining the type properly.

When I changed my call to this:

jQuery.post(
  cartAjaxUrl, 
  {
    quantity: quantity,
    id: variantID
  },
  null,"json"
)

No more errors.

Thanks for the help!


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>