I'm trying to develop a shopping portal in Magento. At homepage, I want to show "add to cart" button next to every product shown there. Home Page is a simple static CMS page. When i tried this code,
<button class="button btn-cart" title="Add to Cart" onclick="setLocation('/n/magento/checkout/cart/add/product/644/qty/1')" type="button"><span><span>Add to Cart</span></span></button>
where 644 is product id, page was redirected to cart page, but product is not being added in the cart. I tried it in firefox, chrome and IE as well but with nothing. I searched through many sites for this, but couldn't find anything useful. If anyone could help regarding this, it will be of great help. Thanks in advance.