Joshua didn't lower his outstretched javelin until the sacred destruction of Ai and all its people was completed.
Israel did get to take the livestock and loot left in the city; God's instructions to Joshua allowed for that.
Joshua burned Ai to the ground. A "heap" of nothing forever, a "no-place" - go see for yourself.
He hanged the king of Ai from a tree. At evening, with the sun going down, Joshua ordered the corpse cut down. They dumped it at the entrance to the city and piled it high with stones - you can go see that also.
Then Joshua built an altar to the God of Israel on Mount Ebal.
He built it following the instructions of Moses the servant of God to the People of Israel and written in the Book of The Revelation of Moses, an altar of whole stones that hadn't been chiseled or shaped by an iron tool. On it they offered to God Whole-Burnt-Offerings and sacrificed Peace-Offerings.
He also wrote out a copy of The Revelation of Moses on the stones. He wrote it with the People of Israel looking on.
All Israel was there, foreigners and citizens alike, with their elders, officers, and judges, standing on opposite sides of the Chest, facing the Levitical priests who carry God's Covenant Chest. Half of the people stood with their backs to Mount Gerizim and half with their backs to Mount Ebal to bless the People of Israel, just as Moses the servant of God had instructed earlier.
After that, he read out everything written in The Revelation, the Blessing and the Curse, everything in the Book of The Revelation.
There wasn't a word of all that Moses commanded that Joshua didn't read to the entire congregation - men, women, children, and foreigners who had been with them on the journey.
Published by permission. Originally published by NavPress in English as THE MESSAGE: The Bible in Contemporary Language copyright 2002 by Eugene Peterson. All rights reserved. (The Message Bible Online)