Danijel,
Trying to understand an array concept on the server side and was hoping you could point me in the right direction.
Let's say I have a javascript function that returns, amongst other things, a JSON array of values using a POST (not a GET), so values will be in the body not the header.
Ex: CompanyName = ACME <--- Simple/single value followed by
Employees[ "Mike", "Suzan", "Danijel", "Richard" ] <--- array
Body example/source form data:
CompanyName=ACME&Employees%5B%5D=Mike&Employees%5B%5D=Suzan&Employees%5B%5D=Danijel&Employees%5B%5D=Richard
How do I get it back on the server side using a TrtcDataProvider.OnDataReceived event? How can I iterate though the elements of the employees array?
procedure TCompanyDM.RtcDataProvider_GetEmployeesOnDataReceived( Sender: TRtcConnection );
var
Srv:TRtcDataServer absolute Sender;
EmployeeIndex: Integer;
CompanyName: String;
begin
if Srv.Request.Complete then
begin
Srv.Request.Params.AddText( Srv.Read );
CompanyName := Srv.Request.Params[ 'CompanyName ' ] ; // This I get Ok, I get this value
Srv.Request.Params[ 'Employees' ] ; // <--- However, this I don't, how do I get this array, how do I read it's properties/elements? Seems to be empty.
for EmployeeIndex := 0 to
do
begin
end;
// Do something with it
Srv.Response.Status( 200, 'Successfull' );
Srv.Response.ContentType := 'application/javascript';
end;
end;
Perhaps I am going about it the wrong way, please include sample code if possible.
Thanks in advance,
Richard