Skip to content

Instantly share code, notes, and snippets.

@hanxiaomax hanxiaomax/getSON.js

Created Nov 21, 2014
Embed
What would you like to do?
根据json创建动态表单
$(function(){
$("input:radio").change(function(){
var selectedvalue = $("input[name='group']:checked").val();
$.getJSON("/static/select.json",function(data){
$("#apply").empty();
$.each(data,function() {
if (this.catagory==selectedvalue)
{
$.each(this.subcatagory, function() {
$("#apply").append("<option>" + this.name + "</option>");
});
};
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.