This is the [remarkable degree of] confidence which we [as believers are entitled to] have before Him: that if we ask anything according to His will, [that is, consistent with His plan and purpose] He hears us. And if we know [for a fact, as indeed we do] that He hears and listens to us in whatever we ask, we [also] know [with settled and absolute knowledge] that we have [granted to us] the requests which we have asked from Him.
1 JOHN 5:14-15 AMP
http://bible.com/1588/1jn.5.14-15.AMP
It is great to know that we can have confidence in Him to answer our prayers. Looks like there are a couple of conditions though.
1. We need to ask according to His will.
This means we need to have a relationship with Him and know His heart.
2. We need to know that He hears us.
We develop our faith by hearing and hearing by the Word of God (Romans10:17)
3. We need to walk in faith.
Believe that our prayer is answered no matter our circumstance. If we don’t see the results right away we can’t stop believing. The answer to our prayer will be manifested at the right time–God’s timing!