I hava a JAVA EE backend and I am using Spring MVC. I have a AJAX call like this:
function getAllProjects() {
$.getJSON("project/getall", function(allProjects) {
???
});
}
My backend system:
@RequestMapping(value="/getall", method=RequestMethod.GET)
public @ResponseBody ??? getAllProjects() {
???
}
What is the content I have to implement so it will work? In the backend system I have from a database call the unique id and the name of the project, for example:
1 => My Test Project
4 => Another One
23 => One More Test
The id and the project name should be returned to the frontend system, so I can build a HTML ul/li list in this kind:
<ul>
<li><a href="/1">My Test Project</a></li>
<li><a href="/4">Another One</a></li>
<li><a href="/23">One More Test</a></li>
</ul>
Does anyone know how this can be done?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…