二级联动

//加载手机品牌
        $.ajax({
            url: 'http://localhost:8486/WebService.asmx/GetPhone',
            type: 'post',
            success: function (data)
            {
                alert(data[0].PhoneName)
                $(data).each(function (index,data) {
                    $("#pinpai").append("<option value=" + data.PhoneCode + ">" + data.PhoneName + "</option>");
                })
            }


        })
        //加载手机型号
        $("#pinpai").change(function () {
            alert($(this).val())
            $.ajax({
                url: 'http://localhost:8486/WebService.asmx/GetXing',
                data: { Phonecode: $(this).val() },
                type:'post',
                success: function (data)
                {
                    $(data).each(function (index, data) {
                        alert(data);
                        $("#xinghao").append("<option value=" + data.XingHCode + ">" + data.XingHName + "</option>");
                    })
                }
            })


        })

存储过程:

ALTER proc [dbo].[proc_sexingh](@Phonecode int)
as
begin 
begin tran
begin try
select * from dbo.TXingH where PhoneID=@Phonecode
commit tran
end try
begin catch
rollback tran
end catch
end

 

posted on 2018-07-29 20:43  浦东区分晏  阅读(139)  评论(0)    收藏  举报