jquery ajax后台返回list,前台用jquery遍历list
<script type="text/javascript">
var baseUrl = '${pageContext.request.contextPath }';
function getLawList() {
var obj=$("#city").val();
alert(obj);
$.ajax({
type: 'POST',
url: baseUrl + "/law/othercity.json",
data:{'city': obj},
dataType:"json",
cache: false,
success: function(json){
if(json.list!=null){
var html ="";
jQuery.each(json.list, function(i,item){
// alert(item.oid+","+item.name);
// html=item.oid+","+item.name;
html=" <p> <a href="+baseUrl+"/law/"+item.oid+">"+item.name+"</a></p>"
});
$("#wenzhangchange").html(html);
}
}
});
}
</script>