【发布时间】:2013-02-15 06:10:46
【问题描述】:
我需要从对数据库进行选择的 JSP 页面中获取一些数据,然后将其放入 div 中。我需要用 ajax 来做这个。
这是我的代码:
$(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 呈现的 throwedError 和未找到 404 错误之外,没有提供给 div 的 ajax 内容需要
谁能帮帮我?
【问题讨论】:
-
如果您收到 404 错误,错误将出现在这里:
url : "busca-notas.jsp", -
是的,但是这个页面在同一目录中
标签: javascript jquery ajax jsp