I opened the Web Core Example TMSWeb_SimpleServe.web project of the Demos.
It works well, of course.
I added a new component, TWebHttpRequest, with his properties by default.
I Added a New button, and in his OnClick event, I added the next code:
procedure TForm1.WebButton2Click(Sender: TObject);
begin
WebHttpRequest2.URL := 'http://192.168.10.146:8080/public';
WebHttpRequest2.Execute;
end;
When I run the program and click this second button, nothing happens.
I Implemented the OnError event handler, and I wrote the next code in it:
procedure TForm1.WebHttpRequest2Error(Sender: TObject; ARequest: TJSXMLHttpRequestRecord; Event: TJSEventRecord; var Handled: Boolean);
begin
ShowMessage('OnError');
Handled := True;
end;
And I discovered that I always have an error.
If I put this request on the Chrome address bar: http://192.168.10.146:8080/public
I get the next text: "This is a public section."
This means the server is working well, but...
1st question. What is wrong with my program?
2nd question. Where can I find an example of how to manage the errors in this case?
OnError Event Handler receives a TJSXMLHttpRequestRecord and a TJSEventRecord parameter, but Nothing in the documentation seems to explain what I can do with these parameters to find the error.
Thanks in advance.