When the children of Israel attacked the city of Ai, "they fled before the men of Ai. And the men of Ai struck some of them, about thirty-six men; and they pursued them from before the gate unto Shebarim and struck them on the slope. And the heart of the people melted and became like water" (Josh. 7:4-5). After such a mighty triumph at Jericho, why did the children of Israel suffer such a dire defeat at Ai? The only thing that Joshua could do was to prostrate himself before God, seek after God, wait on Him, and inquire into the cause of the defeat. Joshua was grieved on account of the danger that Israel had fallen into, but he was grieved more by the dishonor that was brought to the name of the Lord; therefore, he inquired, "What will You do for Your great name?" This was the key to his prayer. He honored the name of God. His concern was for what God would do for the sake of His own name! When Joshua came to this point, God spoke. He said, "Israel has sinned....Thus the children of Israel are not able to stand before their enemies....I will not be with you anymore, unless you destroy that which was devoted to destruction from among you" (vv. 11-12). God was concerned for His own name and could not tolerate sin among His people. He heard Joshua’s prayer and instructed him to discover and do away with the sin that had caused the trouble. After Joshua was clear about the reason for Israel’s defeat, he rose up early in the morning to deal with the matter and discovered that the trouble was Achan’s sin of covetousness. When Israel had dealt with this sin, their defeat was turned into victory. To tolerate and hide one’s sin is to cause God’s name to be blasphemed and to give Satan occasion to attack God’s people. Joshua did not just open his mouth in undiscerning zeal and plead with God to save His people and make them victorious once again. The dishonor that was brought upon God’s great name grieved him, and his plea reminded God to take up the matter for His own name’s sake. His prayer was to the point, and it brought an answer from God. Joshua had to first find the reason for failure. He had to discover the sin and deal with it before glory could be given to Jehovah the God of Israel.
"Then there was a famine in the days of David three years, year after year; and David inquired of the Lord" (v. 1). David did not simply open his lips and pray, "O God, this famine has lasted three years; we beseech Thee to have mercy on us. Take this famine away from us and grant us a rich harvest this year." No, David did not pray in that way. "David inquired of the Lord." He sought to find the cause of the famine. David’s inquiry was to the point; he touched the key. God said, "It is for Saul, and for his bloody house, because he slew the Gibeonites" (v. 1). God will not tolerate the sin of breaking a vow, and David had to deal with this sin. After he dealt with this, the Word of God records that "God was entreated for the land" (v. 14). David possessed the key to prayer; his prayer was to the point, and his prayer brought God’s answer.
(The Key to Prayer, Chapter 1, by Watchman Nee)