add else if for single fetch in ajax