Following code:
Funktion SendDataToServer(SendURL, AnyData : String) : Boolean;
var
bOK : Boolean;
begin
WebHTTPRequest1.Command := httpPOST;
WebHTTPRequest1.URL := SendURL;
WebHTTPRequest1.PostData := AnyData;
WebHTTPRequest1.Execute(
procedure (AResponse: String; AReq: TJSXMLHttpRequest)
begin
ShowMessage('1');
bOK := (AResponse = 'OK');
end
);
result := bOK;
ShowMessage('2');
end;
How I expected it shows first the message '2' and then - after the response from server - the message '1'.
How can I do that ShowMessage('2') waits until the anonymous procedure is completely executed? The function should show first the message '1' and then the message '2'.
How can I realize it?