Paul says, that kind of boasing in man would be impossible if you really savored the truth that abilities are the gift of God and no ground of boasting in man. Submit yourselves therefore to God. Resist the devil and he will flee from you. Draw near to God and he will draw near to you. The opposite of pride here is submitting to God and drawing near to God.
Pride wants to be independent, self-governing, autonomous.
Therefore it inevitably comes into conflict with God. This is why people who do not love to submit to God's teachings stay as far from God as they can. If they come to church and hear God confront their life-style, they will go away and not come back, because they enjoy calling the shots themselves and pulling their own strings. But James says that such people should stop running and draw near. They should stop rebelling and submit.