only making ajax requests on valid elements