내가 뭘 하려는지 생각하는 것은 매우 간단하지만 막혔습니다. 내 아약스 함수의 반환 값을 분할하려고합니다. 분할 할 반환 값을 올바르게 지정하고 있다고 생각하지 않습니다. 코드는 다음과 같습니다.아약스 반환 값 나누기
<script>
function showCars(){
var name = document.getElementById(“carID”).value;
$.ajax({
url : "<%=context%>/ListCarServlet?name=" + name,
type : "POST",
async : false,
success : function(data) {
String[2] a = data.split("|"); //<———don’t think i’m splitting return value correctly
document.getElementById(“value1”).value = a[0];
document.getElementById(“value2”).value = a[1];
}
});
}
</script>
'String [2] a'는 JavaScript가 아닙니다. – nnnnnn