Antiferromagnetic correlation and the pairing mechanism of the cuprates and iron pnictides: A view from the functional renormalization group studies