2016-04-05 14 views
0

我只想補充動態jQuery的查詢生成器在選擇框中的值,但我不斷收到一個錯誤的動態值:無法在jQuery的查詢構建器添加

JSON.parse(data.CancerTypeList).forEach(function(index, val)

代碼我用這個:

var that = this; 
$.ajax({ 
    type: "POST", 
    url: location.protocol + "//" + location.host + appContext, 
    data: "command=CaseServices&action=getCanTypeByDiseaseSubTypeId&diseaseSubType=" + 2, 
    dataType: 'json', 
    success: function(data) { 
     JSON.parse(data.CancerTypeList).forEach(function(index, val) { 
      that.addOption(val.CancerTypeName); 
     }); 
    } 
}); 

從ajax我得到200,但沒有在選擇中添加的值。請根據服務器幫助

+2

是什麼反應的樣子? – Quince

+0

檢查您的'數據'變量值。你從後端響應中獲得有效的數組嗎? –

+0

我使用jquery query builder my req。就像當我從一個表中選擇選項另一個選項進入另一個表... – Anukul

回答

0

的參數是

command=CaseServices 
action=getCanTypeByDiseaseSubTypeId 
diseaseSubType= 2 

這是你所需要的

您可以採取的對象的屏幕截圖中的jQuery收到