I think what I'm trying to do is pretty simple, but I'm stuck. I'm trying to split the returned value of my ajax function. I don't think I'm correctly specifying the return value to split. Code is below.
<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>