One of the lessons the Old Testament stories teach us is that we can be certain God will answer our prayer even before we see the answer.
For instance, before Joshua went to fight the five kings that had joined forces against him, God said, "Do not be afraid of them; I have given them into your hand" (Joshua 10:8). The promise was, "I have given." In God's mind and in Joshua's mind the battle was already won.
So when the Israelites got to the middle of the battle and needed more time, instead of throwing up their hands in despair, Joshua boldly asked God to make the sun stand still. And God did just that. Joshua had been promised victory, so he believed God would provide all that was necessary for them to be triumphant.
I doubt that Joshua would have had the courage to believe God for the impossible if he had not had God's earlier assurance. The secret of victorious prayer is praying until His Spirit assures our spirits that He has heard and we can say with David, "God has surely listened and has heard my prayer" (Ps 66:19). Then we can be confident God will accomplish His purposes as we continue to trust and obey.
As Hannah Whital Smith said, it would be foolish to think that a person we are talking with can assure us she has heard our request but doubt that God can assure us He has heard.
John implies this ability to know He hears when He says, "This is the confidence we have in approaching God; that if we ask anything according to his will, he hears us. And if we know he hears us--whatever we ask--we know that we have whatever we asked of him" (1 Jn. 5:14, 15). To "know he hears" requires persevering in prayer. In fact, the word "ask" in that verse means to crave or to desire.
Dear Lord, teach me to pray with the sincere desire Jacob had when he prayed, "I will not let you go unless you bless me" (Gen. 32:26). Thank You for the assurance that You will answer if I care enough to pray until I know you have heard,