The law requires foreknowledge of an actual terrorist action that the donation contributes to.
Moreover: I'm actually wrong here; the Obama Administration (which, recall, was pushing back on a far broader standard requested by the GOP-controlled Congress) applied a stricter standard, of "substantial support", which I understand to mean that not only do you need to have foreknowledge that your contribution applied to an actual terrorist attack, but also that your contribution actually has to have significantly enabled the attack.
Moreover: I'm actually wrong here; the Obama Administration (which, recall, was pushing back on a far broader standard requested by the GOP-controlled Congress) applied a stricter standard, of "substantial support", which I understand to mean that not only do you need to have foreknowledge that your contribution applied to an actual terrorist attack, but also that your contribution actually has to have significantly enabled the attack.