After days and days of research, I come to call on all of you to save my semester.
What I want is very simple: connect my javascript front-end with my web service REST in java.
Just as test, I created a GET method that returns all elements of my database (in xml, since JSON is not working):
@GET
@Override
@Path("teste")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<Aluno> findAll() {
return super.findAll();
}
Well then. The problem is that I have no idea what to do in my javascript for: 1. communicate with this webservice and 2: Capture the returned values of this xml
My javascript (which is not working, this code I got here in the forum):
$(document).ready(function(){
$.ajax({
url: "http://192.168.1.100:8080/SemanaEngenharia/webresources/service.aluno/teste",
sucess: function(data) {
alert(data);
document.getElementByClassName(tituloFormulario).value = data;
}
});
});