ドロップダウンを変更するにはラジオボタンが必要ですが、機能している場合は、いくつかの点についてよくわかりません。IDとしてCreativeIDを、名前としてCreativeNameを使用したいと思います。これが私のAJAXです:
$('input[name=creativeType]').change(function(){
$.ajax({
url: '/app/components/MailingsReport.cfc',
//POST method is used
type: "POST",
//pass the data
data: {
method: "getCreative",
CreativeType: $('input[name=creativeType]:checked').val(),
datasource: "shopping_cart"
},
dataType: "xml",
//contentType: "application/text; charset=utf-8",
success: function(xml){
$('#creative option').remove();
$(xml).find('number').each(function()
{
$("#creative").append('<option value="' + $(this).text() + '">' + $(this).find('CREATIVENAME').text() + '<\/option>');
});
}
});
これが私の返品データです:
<wddxPacket version='1.0'><header/><data><recordset rowCount='3' fieldNames='CREATIVEID,CREATIVENAME' type='coldfusion.sql.QueryTable'><field name='CREATIVEID'><number>52.0</number><number>65.0</number><number>77.0</number></field><field name='CREATIVENAME'><string>Product One</string><string>Product Two</string><string>Product Three</string></field></recordset></data></wddxPacket>
私の質問:ドロップダウンにデータを入力する方法がわからないため、IDは値であり、製品名はオプションタグの間に表示されます。これに関するどんな助けもいただければ幸いです!