When clicking on a button, I invoke a web service that has its output mapped to a local variable. As part of the same click event after invoking the web service, I also run some javascript to show the updated value of the local variable. The variable value doesn't update. I then tried an alternate arrangement as follows:
When clicking a button, I invoke a web service that has its output mapped to label. As part of the same event, I set the local variable value to the label text, then call some javascript to show the value of the local variable (which doesn't update, although the label clearly updates on the screen to the new value). If I click again, the local variable updates with the label value. Why won't it update initially?
It's very frustrating that I can't take the value returned from the web service and have it feed a javascript script as part of the same event.
Here's what I'm doing as part of a button click event:
invoke web service (which maps output to a label on this screen)
set local storage value = label text
run javascript alert to show local variable value
The label value updates, but the javascript alert showing the local storage value does not update (unless I click again).
What am I doing wrong? Please help.