I wonder if I'm doing this right.
Instead of two interpreter.gen("event.sfm.purchase) calls, I had to introduce a variable "postComplete".
Instead of two assignments to "postComplete", I have to use interpreter.gen().
The transition isn't triggered when I set postComplete=true inside the $.ajax.success() function. I must use an interpreter.gen("event.sf.postComplete") call.
SCION throws the
"gen called before previous call to gen could complete. If executed in single-threaded environment, this means it was called recursively, which is illegal, as it would break SCION step semantics."
exception when I use interpreter.gen("event.sfm.postComplete") inside the ELSE branch.
<datamodel>
<data id="postComplete" expr="false" />
</datamodel>
<state id="
sfm.sales.post">
<onentry>
<script>
if ('' != getSalesEmail()) {
$.ajax({type: "POST",
url: "URL",
data: "some data",
success: function(data) {
interpreter.gen("event.sfm.postComplete");
}});
} else {
postComplete=true;
}
</script>
</onentry>
<transition target="sfm.purchase" event="event.sfm.postComplete" />
<transition target="sfm.purchase" cond="postComplete" />
</state>
tia,
jec