in Second Kings 22:19 because your heart was softened and you humbled yourself before the LoRD when you heard what I decreed against this
place and its inhabitants-that it will become a desolation
and a curse–and because you rent your clothes and wept
before Me, I for My part have listened-declares the
Lord. 20 Assuredly, I will gather you to your fathers and
you will be laid in your tomb in peace.
the question is that Joish pray to God
Yes he did, just renting his clothes, and crying was not the main point, but the prayer that came along with it.
Malbim Kings 2 22-19.