I need to grab some data from a JSP page that does a select on a database and then put inside a div. I need to do this with ajax.
Here is my code:
$(function() {
teste();
});
function teste() {
var v1 = document.getElementById(selCodigo).value;
alert(v1);
$.ajax({
type : GET,
data : turma=+v1,
url : busca-notas.jsp,
success : function(resposta){
alert(DEU CERTO);
},
error : function(xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
document.getElementById(notas).innerHTML = ERRO;
}
});
}
I tested the variable v1
and the value that it receives necessary, and in my JSP page, I do this:
String turmaSelecionada = request.getParameter(turma);
the problem is that the ajax content that does not feed into the div need, beyond what the xhr.status
presents thrownError and a 404 error not found
Can anyone help me?