|
<< Click to Display Table of Contents >> Navigation: Telegram > 2024 > 09 > 06 > Telegram_2024-09-06T15 |
2024-09-06T15:01:10
I've just created and published a new demo for you:
type: link https://github.com/Atozed/IntraWeb/tree/master/15/Delphi/TaskInThread2
Very simple to understand how it works. Please check the comments in the code
2024-09-06T15:10:36
function TContentXML.Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication;
aParams: TStrings): boolean;
begin
Result := true;
if Assigned(aReply) then begin
if aRequest.HttpMethod=hmpost then
begin
if aRequest.QueryFields.Values['command']='send' then
begin
aReply.ContentType := MIME_html;
aSession.RegisterCallBack('ProcessString',
procedure (aParams: TStrings; out aResult: string)
var
s: string;
begin
s := aParams.Values['s'];
aReply.WriteString('String received is: ' + s);
end
);
aSession.ExecuteJS(
'ajaxCall(\ProcessString\, \&s=iiiiiii\, false, '
+' function(response) { '
+' return true; '
+' } '
+');'
);
end;
end;
aSession.Terminate;
end;
end;
2024-09-06T15:10:45
hi
how i cen use it? type: mention @Alex7691
2024-09-06T15:53:29
I'm not sure what you are trying to accomplish here.
There are a few problems with your approach. This content handler it not a TContentForm (meaning that it has no form). The callback registration/execution mechanism requires an active form (the context where the callback is executed is the context of the active form).
2024-09-06T15:53:59
So, registering a callback like that won't succeed unless you register it from the active form that will receive the callback