use pattern instead of filter in the ajax call, avoids the duplication here