I'm making a Delphi XE5 VCL Forms Application and there is a TIdHTTPServer
on the main form and a CommandGet
of the IdHTTPServer
procedure:
procedure TForm1.IdHTTPServerCommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var pageContent: TStringList;
begin
if pos('profile&userName=', ARequestInfo.UnparsedParams) > 0 then
begin
pageContent:= TStringList.Create;
try
pageContent.Add('<html>');
pageContent.Add('<head>');
pageContent.Add('<title>Profile</title>');
pageContent.Add('</head>');
pageContent.Add('<body>');
pageContent.Add('<h1>Profile<h1>');
pageContent.Add
('<input id="subjects" value="Subjects" type="button"/>');
pageContent.Add('<div id="table-content">');
pageContent.Add('</div>');
pageContent.Add('</body>');
pageContent.Add('</html>');
AResponseInfo.ContentText := pageContent.Text;
finally
pageContent.Free;
end;
end;
end;
What I want to do is when the user clicks the button "Subjects
" to call this function that generates a HTML table with students courses and marks. The function reads data from the database and generates a table. I want to avoid reloading the whole page (I try to insert the table in the div tags).