The Ninevites were spared ONLY because of the grace of God. But they would never have received this grace had they not believed the preaching of of the word and repented of their evil ways.
To say that God knew beforehand of their repentance is to make God a deliberate liar, for He said that in forty days Nineveh would be destroyed. To say that they had no choice to repent because God had determined beforehand that they would do so, is to say they did not repent at all, they did not change their minds; God changed their minds.
When someone puts it plain and simple, Calvinists cry foul and come up with some bogus explanation of the clear reading of scripture (the passage is in human terms to aid in human understanding).
Or that God knew that Nineveh would repent, he just needed to have Jonah lie to them first.
David, the man after God's own heart, knew God had the ability to change his mind on things he had declared. It's called grace. This is why David pleaded for his child to live.
2 Samuel 12
14 Howbeit, because by this deed thou hast given great occasion to the enemies of the Lord to blaspheme,
the child also that is born unto thee shall surely die.
15 And Nathan departed unto his house. And the Lord struck the child that Uriah's wife bare unto David, and it was very sick.
16
David therefore besought God for the child; and David fasted, and went in, and lay all night upon the earth.
17 And the elders of his house arose, and went to him, to raise him up from the earth: but he would not, neither did he eat bread with them.
18 And it came to pass on the seventh day, that the child died. And the servants of David feared to tell him that the child was dead: for they said, Behold, while the child was yet alive, we spake unto him, and he would not hearken unto our voice: how will he then vex himself, if we tell him that the child is dead?
19 But when David saw that his servants whispered, David perceived that the child was dead: therefore David said unto his servants, Is the child dead? And they said, He is dead.
20 Then David arose from the earth, and washed, and anointed himself, and changed his apparel, and came into the house of the Lord, and worshipped: then he came to his own house; and when he required, they set bread before him, and he did eat.
21 Then said his servants unto him, What thing is this that thou hast done? thou didst fast and weep for the child, while it was alive; but when the child was dead, thou didst rise and eat bread.
22
And he said, While the child was yet alive, I fasted and wept: for I said, Who can tell whether God will be gracious to me, that the child may live?
23 But now he is dead, wherefore should I fast? can I bring him back again? I shall go to him, but he shall not return to me.