After the ajax call, there is a return missing. Otherwise the funktion checkToDelete will never give a return value.