Javascript jquery ajax调用jsp页面输入未定义

Javascript jquery ajax调用jsp页面输入未定义,javascript,jquery,html,jsp,Javascript,Jquery,Html,Jsp,我通过处理下载文件的jQuery调用JSP页面 $("#download").click(function(e){ $.get("download.jsp", {filename:"file.txt"},doUpdate()); }); 我的更新日期是 响应未定义 我知道JSP页面正在工作,因为如果我硬编码文件名,页面将正确执行 在jsp中,我使用以下方法获取文件名: String filename = request.getParameter("filename"); 我做错什么了

我通过处理下载文件的jQuery调用JSP页面

$("#download").click(function(e){
    $.get("download.jsp", {filename:"file.txt"},doUpdate());
});
我的更新日期是

响应未定义

我知道JSP页面正在工作,因为如果我硬编码文件名,页面将正确执行

在jsp中,我使用以下方法获取文件名:

String filename = request.getParameter("filename");

我做错什么了吗

是的,您没有将数据传递给函数,请尝试:

$.get("download.jsp", {filename:"file.txt"}, doUpdate);


您对处理程序的引用不正确

$.get("download.jsp", {filename:"file.txt"},doUpdate());
应该是

$.get("download.jsp", {filename:"file.txt"},doUpdate);

如果您离开(),那么您正在执行函数,并且它是作为参数传递给get方法的返回值

谢谢您的快速响应!
$.get("download.jsp", {filename:"file.txt"},doUpdate());
$.get("download.jsp", {filename:"file.txt"},doUpdate);