0

我正在尝试在 magento 中每 10 秒刷新一次产品列表。

<script>
function AutoRefresh(){
    var xmlHttp;
    try{
      xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
    }
    catch (e){
      try{
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
      }
      catch (e){
        try{
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e){
          alert("No AJAX");
          return false;
        }
      }
    }

    xmlHttp.onreadystatechange=function(){

      if(xmlHttp.readyState==4){
        document.getElementById('products-grid').innerHTML=xmlHttp.responseText;
        setTimeout('AutoRefresh()',10000); // JavaScript function calls AutoRefresh() every 3 seconds
      }
    }
    xmlHttp.open("GET","<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)?>list-response.php",true);
    xmlHttp.send(null);
  }

  AutoRefresh();

</script>

但是如何将值发布到特定页面我的意思是我正在发送到这个页面

xmlHttp.open("GET","<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)?>list-response.php",true);

但这是不正确的。有人告诉我如何使用 magento 每 10 秒刷新一次产品列表页面。

谢谢

4

0 回答 0