Difference between revisions of "Using the Spiffy Ajax API"

From Spiffy Stores Knowledge Base

(Created page with "You can access the Spiffy Ajax API from your theme to enhance your customers' experience on your store. The Spiffy Ajax API allows your customer to add items to the cart, upd...")
 
m
Line 1: Line 1:
 
You can access the Spiffy Ajax API from your theme to enhance your customers' experience on your store.
 
You can access the Spiffy Ajax API from your theme to enhance your customers' experience on your store.
  
The Spiffy Ajax API allows your customer to add items to the cart, update quantities in the cart and fetch information about the cart, all without requiring a page refresh.  
+
The Spiffy Ajax API allows your customer to add items to the cart, update quantities in the cart and fetch information about the cart, all without requiring a page refresh. You can use the API to create 'add to cart' buttons that keep the customer on the product pages.
  
 
The Spiffy Ajax API also allows you to directly fetch information about a particular product using its handle.
 
The Spiffy Ajax API also allows you to directly fetch information about a particular product using its handle.
 +
 +
== Simple Access using the Wrapper Library ==
 +
 +
If you are using the jQuery JavaScript framework in your theme, then you can use the Spiffy Ajax API wrapper library to simplify the use of the API.
 +
 +
Of course, it's not necessary to use the wrapper library, or to code in jQuery to use the Ajax API, but if you do use the wrapper library, then a lot of the detailed API access work has already been done for you.
 +
 +
To use the Spiffy Ajax API jQuery wrapper library, you will need to include the following code in your '''theme.liquid''' file.
 +
 +
<pre>
 +
{{ 'jquery.js' | global_asset_url | script_tag }}
 +
{{ 'api.jquery.js' | global_asset_url | script_tag }}
 +
</pre>

Revision as of 11:31, 26 August 2015

You can access the Spiffy Ajax API from your theme to enhance your customers' experience on your store.

The Spiffy Ajax API allows your customer to add items to the cart, update quantities in the cart and fetch information about the cart, all without requiring a page refresh. You can use the API to create 'add to cart' buttons that keep the customer on the product pages.

The Spiffy Ajax API also allows you to directly fetch information about a particular product using its handle.

Simple Access using the Wrapper Library

If you are using the jQuery JavaScript framework in your theme, then you can use the Spiffy Ajax API wrapper library to simplify the use of the API.

Of course, it's not necessary to use the wrapper library, or to code in jQuery to use the Ajax API, but if you do use the wrapper library, then a lot of the detailed API access work has already been done for you.

To use the Spiffy Ajax API jQuery wrapper library, you will need to include the following code in your theme.liquid file.

{{ 'jquery.js' | global_asset_url | script_tag }}
{{ 'api.jquery.js' | global_asset_url | script_tag }}