在列表框中更改第一个列表框中获取值

时间:2012-05-19 06:12:17

标签: php ajax

<script type="text/javascript">
            function getquestion() {

                //querystring value is selected value of parent drop down list
                var qs = $("#product").val();
                    //show message indicating we're getting new values
                    $("#question").append(new Option('Getting Question List ...'));
                    //declare options array and populate
                    var questions = new Array();
                    var id = "../elements/question-add.php?Product=" + qs;

                    $.get("../elements/question-add.php?Product=" + qs, function(data) { alert('mn');
                            eval(data);
                            if(questions.length > 0) {
                                addOptions(questions);
                            }
                        }
                    );
                }
            function addOptions(cl) {
                //enable child select and clear current child options
                $("#question").removeAttr("disabled");
                $("#question").html('');
                //repopulate child list with array from helper page
                var city = document.getElementById('question');
                document.getElementById('question').setAttribute("class", "inputbox");
                for(var i = 0; i < cl.length; i++) {
                    city.options[i] = new Option(cl[i].text, cl[i].value);
                }
            }
        </script>

我无法在第二个列表框中获取任何值因为getquestion()函数正在运行但addoptions()函数无法正常工作

0 个答案:

没有答案