Hi are you getting the correct answer from Script Include? Can you place the alert in your client script and test like below

function ajaxResponse(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        alert(answer);
        
        var values = answer.split(',');
        
        if (values.indexOf(newValue) != -1)
          {
            alert("This value already exists");
            return false ; //abort submission you need this to abort submission
          }
                    
        
    }

Regards
Harish