我试图将多个值返回给 jqueryAjax 成功,但没有这样做。这是我到目前为止所做的......
String emp = request.getParameter("ID");
ArrayList<String> al = new ArrayList();
al=ur.editLeave(emp);
String cl = al.get(0);
out.print(cl);
out.print(al.get(1));
out.print(al.get(2));
Run Code Online (Sandbox Code Playgroud)
从这个jsp页面我尝试返回3个值。
$.ajax({
type: "GET",
data: 'ID=' + idel,
async: false,
url: "ForleaveMaster.jsp?Eleave=l",
success: function(cl, ml, ot) {
alert(cl, ml, ot);
$('input[id=ELM_CL]').val($.trim(cl));
$('input[id=ELM_ML]').val($.trim(cl));
$('input[id=ELM_OT]').val($.trim(cl));
},
error: function() {}
});
Run Code Online (Sandbox Code Playgroud)
请帮帮我。
您返回的所有内容都作为第一个参数传递给您的函数。
$.ajax({
type: "GET",
data: 'ID=' + idel,
async: false,
url: "ForleaveMaster.jsp?Eleave=l",
success: function(data) {
var array_data = String(data).split("\n");
var cl = array_data[0],
mt = array_data[1],
ot = array_data[2];
alert(cl,ml,ot);
$('input[id=ELM_CL]').val($.trim(cl));
$('input[id=ELM_ML]').val($.trim(cl));
$('input[id=ELM_OT]').val($.trim(cl));
},
error: function() {
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10321 次 |
| 最近记录: |