From my reading this evening:
“Thou didst well in that it was in thine heart,” said the Lord to David, even when He did not accept what David proposed to do; and I believe there may be glory brought to God, not only by those prayers which are manifestly answered, but by those which for wise reasons the good Lord is pleased to lay on one side. We are nothing better than children even in prayer, and therefore it is not every request that is wise; but yet we are children, and therefore the cries which come from our hearts touch the heart of our great Father in Heaven.
C H Spurgeon, “Only A Prayer Meeting!” pp.39-40.