I have an array with different ID's. This array is populated from query, so number of ID's can be different each time. So I want to check if my eventID exist in that array, if eventID has matching ID in array I want to alert message, if not I want to submit my form. My problem is when eventID does not match any record in array my form does not get submitted. Here is my code:
 function saveSlots(){
                var records = [];
                var eventID = '#eventID#';
                //here is my array
                records.push(55,56,78,90,44); 
                for(var i=0; i< records.length; i++){
                    if(records[i] == eventID){
                        alert('duplicate')
                    }else{
                        //Submit the form
                    }
                }   
            }
For some reason my else never get executed. In my if statement I just need to check if one of the records from array is matching eventID and if does I do not need to check for other ID's in array. If anyone can help with this problem please let me know.
 
     
    