확실한 것은 확실하지만 AJAX 요청 내에서 변수 데이터를 설정하는 것 같습니다.AJAX 호출에서 변수를 설정 하시겠습니까?
내 서블릿은 숫자 배열을 반환합니다.
int[] array = {1,2,4,5,3,5,3,5};
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(new Gson().toJson(array));
jquery 배열로 json 데이터를 저장하려고하는 jquery로 데이터가 전달됩니다.
var test2 = [];
$.post("servlet", { info: data},
function(data) {
alert(data); // this alerts what i want stored...
test2.push(3); // testing if i can add 3 to test FAILS
});
test2.push(9); //this works
test2.push(9); //this works
options.series[0].data = test2;
ajax 호출로 테스트에 숫자를 넣을 수없는 이유는 무엇입니까? 거짓
는내가 원하는 최종 결과를 비동기식으로 완전한 AJAX() 함수를 사용
'test2'에 대한 변수 선언이 없습니다. 이것은 오타입니까? –
예 업데이트 됨 – Lunar
'경고 (데이터)'가 실행되고 있습니까? –