adding ajax for Pattern