Velocity Coding Example -

<!-- Add jQuery library-->
<script type="text/javascript" src="$baseUrl/js/jquery-1.10.1.min.js"></script>
 
<script type="text/javascript">
  function addToCart(itemId) {
    jQuery.ajax({
                        dataType: "json",
            url: "/cgi-bin/UCEditor",
            data: {
            "merchantId": "DEMO", "add": itemId, "json": "true"
        },
            success: function(data) {
          jQuery("#subtotal").html(data.subtotal);
          jQuery("#itemCount").html(data.item_count);
            }
            });
   
    return false;
  }
</script>
 
<span id="subtotal"></span>
<span id="itemCount"></span>
 
<a href="#" onclick="javascript:addToCart('GSHW-SNAPW')">test add</a>