Getting Cart content via /cart.js

Shopify Expert
26 0 14

I can add and update cart items just fine via the Shopify Ajax API but when I try to get cart contents via the below calls:

jQuery.get('/cart.js') or jQuery.getJSON('/cart.js')

The only response I ever get is:


From the documention, this should be returning the full cart in JSON format (starting with token).

Anyone have ideas on what I'm doing wrong?

Shopify Expert
26 0 14

In case anyone needs this. I was able to get access to the cart like so:

jQuery.getJSON('/cart.js', function(cart) {
   // now have access to Shopify cart object
   alert('There are now ' + cart.item_count + ' items in the cart.');
} );