2017-01-28 16 views
0

私の問題は、ドロップダウンリストからアイテムをドロップダウンしてボタンをクリックするように変更しましたが、最初のアイテムをクリックすると、 2つ目は2つのレコードに2回アイテムをドロップします!!そして第三に、これは私のコード2つ以上のレコードをクリックボタンでコマンドを呼び出す際の問題

//to get the elements by document.ready function// 

<script type="text/javascript"> 
    $(document).ready(function(){ 
    $("#DropDownList2").change(function() 
    { 
// button to drop down the record to table// 

$('#button1').click(function(){ 
    GetData($("#DropDownList2 option:selected").text()); 
    }); 
    }); 
    }); 
    function GetData(itemName){ 

    $.ajax({ 
    url:'Default2.aspx?brand='+$("#DropDownList1 option:selected").text()+'&item='+itemName+'&itemId='+$("#DropDownList2 option:selected").val()+'', 

    type:'GET', 
    success: function(data) 
    { 
    if($("#tableContent tr:last").html() == undefined) 
    { 
    $("#tableContent").html(data); 
    } 
    else{ 
    $("#tableContent tr:last").after(data); 
    } 
    } 
    }); 
    } 

答えて

0

//である私はそれをコメント

//以下$(で感謝を解決

等... 3回のn 3つのレコードにアイテムをドロップ"#DropDownList2")。change(function(){}

関連する問題