10 Now Joshua rose early in the morning and mustered the people, and he went up with the elders of Israel before the people to Ai. 11 Then all the people of war who were with him went up and drew near and arrived in front of the city, and camped on the north side of Ai. Now there was a valley between him and Ai. 12 And he took about 5,000 men and set them in ambush between Bethel and Ai, on the west side of the [c]city. 13 So they stationed the people, all the army that was on the north side of the city, and its rear guard on the west side of the city, and Joshua spent that night in the midst of the valley. 14 It came about when the king of Ai saw it, that the men of the city hurried and rose up early and went out to meet Israel in battle, he and all his people at the appointed place before the desert plain. But he did not know that there was an ambush against him behind the city. 15 Joshua and all Israel pretended to be beaten before them, and fled by the way of the wilderness. 16 And all the people who were in the city were called together to pursue them, and they pursued Joshua and were drawn away from the city. 17 So not a man was left in Ai or Bethel who had not gone out after Israel, and they left the city [d]unguarded and pursued Israel.
18 Then the Lord said to Joshua, “Stretch out the javelin that is in your hand toward Ai, for I will give it into your hand.” So Joshua stretched out the javelin that was in his hand toward the city. 19 The men in ambush rose quickly from their place, and when he had stretched out his hand, they ran and entered the city and captured it, and they quickly set the city on fire. 20 When the men of Ai turned [e]back and looked, behold, the smoke of the city ascended to the sky, and they had no place to flee this way or that, for the people who had been fleeing to the wilderness turned against the pursuers. 21 When Joshua and all Israel saw that the men in ambush had captured the city and that the smoke of the city ascended, they turned back and [f]slew the men of Ai. 22 [g]The others came out from the city to encounter them, so that they were trapped in the midst of Israel, [h]some on this side and some on that side; and they [i]slew them until no one was left [j]of those who survived or escaped. 23 But they took alive the king of Ai and brought him to Joshua.
24 Now when Israel had finished killing all the inhabitants of Ai in the field in the wilderness where they pursued them, and all of them were fallen by the edge of the sword until they were destroyed, then all Israel returned to Ai and struck it with the edge of the sword. 25 All who fell that day, both men and women, were 12,000—all the [k]people of Ai. 26 For Joshua did not withdraw his hand with which he stretched out the javelin until he had [l]utterly destroyed all the inhabitants of Ai. 27 Israel took only the cattle and the spoil of that city as plunder for themselves, according to the word of the Lord which He had commanded Joshua. 28 So Joshua burned Ai and made it a heap forever, a desolation until this day. 29 He hanged the king of Ai on a tree until evening; and at sunset Joshua gave command and they took his body down from the tree and threw it at the entrance of the city gate, and raised over it a great heap of stones that stands to this day.
The plan of attack comes off without a hitch, and I think there are two very important reasons for it. Of course, the more important one was that they had disobeyed God and taken spoil from Jericho. The second one was the opposite. Instead of looking to God for a plan of attack (to obey), Joshua just went with what the people were saying, and trusted that they could just squash Ai with a very small army.
Now, one would hope you could trust what your advisers were saying, but when one sees later that there were 12,000 people in Ai, it seems a bit silly to only take 3,000 to attack. In that day, less than half of those were likely to be fighting men. But still, it’s not a lopsided battle by any means, and the men of Ai were fighting for their lives, their homes, and their families.
After they took care of the disobedience, Joshua rightly looks to God for a battle plan, and obeys it without hesitation. That’s not to say we can just say, “Hey God, what should I do today?” and then expect an audible reply. You might get one, but more likely, what you’ve just done is to re-orient your focus. You have set your eyes on God, and considered what it is that He might want you to do.
When your gaze is in the right direction, then your mind will often follow properly (perhaps with a bit of coercion). Fix your eyes on God, and seek His path for your life. It may be what you had in mind already, but it might not, and it’s always best to reconcile the two.