I have created one ajax page in my root folder to list all the products based on the filters. In that page I want ADD TO CART button. Please help me to find a solution for this.
Are you included the Mage.php your individual file?
If yes, you can use this code:
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="addtocart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add', array('product'=>$_product->getProductId(),'qty'=>1)) ?>')"/>