It is only when we pray for something according to the will of God that we have the promise of being heard and answered.
God alone fully understands what each one of us needs; we make mistakes continually and pray for things which would be harmful to us if we received them. Afterwards we see our mistakes and realize that God is good and wise in not giving us these things, even though we plead ever so earnestly for them.