现在遇到一个后端返回的是一个ResultObject 结果类型,我这边只能够接收Json的,类似于这种,需要解析的类的类型,如何解析并显示呀?
下面是前端页面的接收代码
```java
$.ajax({
type: "get",
url: 'http://localhost:8080/getMusicAll',
dataType: "json",
contentType: "application/json",
// data: JSON.stringify({
// 'text001': str
// }),
//请求成功时调用的函数
success: function (resp) {
// console.log(resp)
show(resp);
}
});
//格式化数据并在class="main"的标签的中<tbody>中显示
function show(result) {
var cont = $(".main tbody.tbodyAllMusic");
cont.html(""); //清空
for (var row of result) {
var str = "<tr>" +
"<td class='thStyle'>" + row.id + "</td>" +
"<td class='thStyle'>" + row.singleName + "</td>" +
"<td class='thStyle'>" + row.singer + "</td>" +
"<td class='thStyle'>" + row.lyricist + "</td>" +
```