SpiringBoot:ajax遍历后台返回List

发布于 2018-05-03  2146 次阅读


$.ajax({
    type : 'GET',
    url : "http://localhost:8080/getdata",
    data : "",
    dataType : "json",
    contentType : "application/json",
    success : function(data) {
        jQuery.each(data,function(key,value){
            alert(value.id+"    "+value.username);
        })
        // $("#username").text(data.username);
       // $("#password").text(data.password);
        //alert(data.get("username"));
        //window.location.href = data.url;
    },
    error : function(data) {
        //alert(JSON.stringify(data));
        alert("失败");
    },

});

个人博客,用于记录工作日常的问题。