小服务程序
String getCodeList = (new JSONArray(rmsCodeList)).toString();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(getCodeList);
jQuery
$(document).ready(function() {
var getdata;
$.post("GetItemCode", function(data) {
getdata=data;
});
});
工作正常,我在getdata上得到了完整的数组
写二
String getCodeList = (new JSONArray(rmsCodeList)).toString();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(getCodeList);
String getNameList = (new JSONArray(rmsNameList)).toString();
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(getNameList);
如何在不同的变量上获得两个数组
$(document).ready(function() {
var getdata1;
var getdata2;
$.post("GetItemCode", function(data) {
getdata1=?;
getdata2=?;
});
});