Magento :自定义 Ajax 调用下拉列表更改


magento :custom ajax call on dropdown change

我添加了自定义.js到我的产品编辑页面

我已经添加了ID为"getdata"的属性,现在还有另一个文件,其中的值根据用户在下拉列表中选择的内容显示

我需要对其他页面进行 ajax 调用,值为 dropddown,调用 ajax 很简单我想使用 Magento 内置调用 ajax url 和加载器的方式,我也该怎么做?

我在下面写了代码,但它现在可以工作了

function myajaxcall(id){
new Ajax.Request('/a.php?id='+id, {
  onSuccess: function(response) {
    alert(response);
  }
});
}

我错过了什么,请帮助

尝试使用以下代码:

    function myajaxcall(id){
new Ajax.Request('a.php?id='+id, {
  method:'get',
  onSuccess: function(data) {
    var response = data.responseText || "no response text";
    alert("Success! 'n'n" + response);
  },
  onFailure: function() { alert('Something went wrong...'); }
});
}