Prefers To Do It In His Pants

My son is three years and three months old. I have been toilet training him since he was one and a half years ago. However, he is well trained in going to the toilet on time. He never wets his bed at night. The problem with him is that he refuses to defecate in the toilet and insists on doing it in his pants!