Home > php教程 > php手册 > thinkphp+ajax 实现二级联动

thinkphp+ajax 实现二级联动

WBOY
Release: 2016-06-07 11:37:07
Original
1284 people have browsed it

thinkphp+ajax 实现二级联动


$("#cattype").change(function(){
var catid = $(this).val(); //获取切换的类别的id

$.getJSON('getCate',{catid:catid},function(data){
$('#catchild option[value!=""]').remove(); //清空option 每次改变option的时候载入新的数据
//alert(data.length);
if(catid==''){
vals="";
$(vals).appendTo("#catchild");
}else{
for(var i=0;i var vals='';
vals+="";
$(vals).appendTo("#catchild");
}
}

})
});

参考:http://www.fushengphp.com/jsjszt/81.html

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template