0

Here is the situation, I have created an array of drop-down box data that I want the data to show based on different queries.

So far I can go to the different queries based on the array. That part works. The issue is that it doesn't fill the drop-down list. It seems that I can't pass the drop-down data over the success function. Here is the code in question.

    function ajaxcalls(id) {

        var dropdowns = ["category","supplier"];

        for (i = 0; i < dropdowns.length; i++)  {

            $("#"+dropdowns[i]).html("");

            $.ajax({
                type: "GET",
                url: "template/pages/getdisp.php",
                data: ""+dropdowns[i]+"=" + id,
                async: true,
                success: function (data) {
                    parse_data = JSON.parse(data);

                    $.each(parse_data,function(index,value){
                        $("#"+dropdowns[i]).append("<option value="+ value.id + ">" + value.name + "</option>");
                    });
                }
            });
        }

    }

How can pass the dropdown array info into the success function?

Thanks!

Kevin
  • 121
  • 11

0 Answers0