簡體   English   中英

magento:下拉列表更改時自定義ajax調用

[英]magento :custom ajax call on dropdown change

我向我的產品編輯頁面添加了custom.js

我添加了ID為“ getdata”的屬性,現在還有另一個文件,其中根據用戶在下拉菜單中的選擇顯示值

我需要使用dropddown的值對其他頁面進行ajax調用,調用ajax很簡單,我想使用以調用ajax url和loader的方式構建的magento,我該怎么做?

我寫了下面的代碼,但現在可以工作了

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...'); }
});
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM