magento - ajax into another phtml file -
i have 2 .phtml files in magento, 1 used in home cms page , referenced this:
{{block type="catalog/product_list" category_id="11" template="catalog/product/special-products.phtml"}}
then wish ajax;
<script> function loadxmldoc(pageno) { var xmlhttp; if (pageno.length==0) { document.getelementbyid("productsdiv").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("productsdiv").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","special-products-ajax.phtml?page_number="+pageno,true); xmlhttp.send(); } </script> <script> //call after page loaded window.onload = loadxmldoc("1"); </script>
within file (special-products.phtml) access special-products-ajax.phtml i've put in same directory xmlhttp.status returning 404 (not found). tried moving file folder in root directory "/scripts", ajax worked didnt have access mage app. please me im stuck on one.
Comments
Post a Comment