"If ye abide in me, and my words abide in you, ye shall ask what ye will, and it shall be done unto you." (John 15:7)
This is a tremendous promise to us that if we live in Christ, and His Word lives in us, that we can ask whatever we will, and it shall be done for us.
1 John 4:14 says: "This is the confidence that we have in Him, that, if we ask anything according to His will, He hears us."
God does not hear the prayer that is outside of His will, but the saint who abides in Christ and has His Word abiding in him will always pray according to the will of God, because God's will becomes the will of the child of God.
"For it is God that works within you both to will and to do of His good pleasure." (Phil.2:13)
