You will not enter Jannah until you believe, and you shall not believe until you love one another. May I inform you of something, if you do, you love each other. This is the reason Muslims have been enjoined to greet each other regardless of acquaintance. It does not, however, mean that a Muslim will be a true believer or entitled to Jannah, by mere greeting. What it really means is that his Faith will become meaningful only when it is supported by actions.
Greeting is an Islamic custom and a practical form and demonstration of it.
The combination of Faith and its practice will take a Muslim to Jannah. Almighty Allah rewarded them for their devotion to Islam with immense love for Faith - the love which became a symbol of their Faith and love for Allah. Not only that, because of this devotion of the Ansar, everyone who entertained jealousy and hatred against them was declared a hypocrite by Allah. In the pre-Islamic days they were enemies to each other. When they embraced Islam, they became close brothers.