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

thinkphp+ajax 实现二级联动

WBOY
WBOYOriginal
2016-06-07 11:37:071281browse

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元

Statement:
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
Previous article:thinkphp通用后台开发框架Next article:七牛fetch