日期:2014-05-16  浏览次数:20919 次

ajax 返回值读取问题
$.ajax({
                                type: "post",
                                contentType: "application/json",
                                url: /DCSRequestName.asmx/GetName",
                                data: "{str:'" + $("#txtName").val() + "'}",
                                dataType: "json",
                                success: function (result) {
                                    $("#lstAgent").empty();
                                    if (result.d != null){                                        $.each(result.d, function (index, data) {
                                            $("#lstAgent").append("<option value='" + index + "'>" + data + "</option>");
                                            if ($("#txtName").val() == data)
                                                $("#lstAgent").val(index);
                                        });
                                        $("#lstAgent").attr("size", $("#lstAgent option").length + 1);