我需要用ajax从数据库的JSP页面中获取一些数据,然后放入div中。
这是我的代码:
$(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";
}
});
}
我测试了变量 v1 及其必需的值,在我的JSP页面中:
String turmaSelecionada = request.getParameter("turma");
问题是,除了 xhr.status 所呈现的thrownError和未发现404错误之外,ajax内容没有馈入div。
有人能帮帮我吗?