[Pas2js] How to add script like the below in pas2js

Anderson Junior andersonscinfo at gmail.com
Sat Aug 26 15:22:56 CEST 2023


@Michael Van Canneyt

I apologize, but I forgot an important part of the code that I want to put
in the script, which would be one: setInterval(atualizarTabela, 1000);

getting like this:
<script> // Função para atualizar a tabela function atualizarTabela() { //
Fazer uma solicitação AJAX ao servidor $.ajax({ url: "/api/dados", success:
function(dados) { // Atualizar a tabela com os dados recebidos $("#tabela
tbody").html(dados); } }); } // Chamar a função a cada segundo
setInterval(atualizarTabela,
1000); </script>


Em sáb., 26 de ago. de 2023 às 06:00, <pas2js-request at lists.freepascal.org>
escreveu:

> Send Pas2js mailing list submissions to
>         pas2js at lists.freepascal.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
> or, via email, send a message with subject or body 'help' to
>         pas2js-request at lists.freepascal.org
>
> You can reach the person managing the list at
>         pas2js-owner at lists.freepascal.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Pas2js digest..."
>
>
> Today's Topics:
>
>    1. How to add script like the below in pas2js (Anderson Junior)
>    2. Re: How to add script like the below in pas2js
>       (Michael Van Canneyt)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 25 Aug 2023 13:05:43 -0400
> From: Anderson Junior <andersonscinfo at gmail.com>
> To: pas2js at lists.freepascal.org
> Subject: [Pas2js] How to add script like the below in pas2js
> Message-ID:
>         <
> CAAFh3a0ucADqV5T+tyjO4bqd0DehTgJWtLKGpXXOVR2vGYBsoA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> >
> > <script> // Fun??o para atualizar a tabela function atualizarTabela() {
> //
> > Fazer uma solicita??o AJAX ao servidor $.ajax({ url: "/api/dados",
> success:
> > function(dados) { // Atualizar a tabela com os dados recebidos $("#tabela
> > tbody").html(dados); } }); }
>
>
>
> I want to add this script to the end of my page to keep updating.
> Is it possible to do this, or is it better to put it in the html file?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.freepascal.org/pipermail/pas2js/attachments/20230825/aab11522/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Fri, 25 Aug 2023 23:17:35 +0200 (CEST)
> From: Michael Van Canneyt <michael at freepascal.org>
> To: Anderson Junior via Pas2js <pas2js at lists.freepascal.org>
> Subject: Re: [Pas2js] How to add script like the below in pas2js
> Message-ID: <a71e95e4-6bd7-30db-23bf-1a387cfcefdc at freepascal.org>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
>
>
> On Fri, 25 Aug 2023, Anderson Junior via Pas2js wrote:
>
> >>
> >> <script> // Fun??o para atualizar a tabela function atualizarTabela() {
> //
> >> Fazer uma solicita??o AJAX ao servidor $.ajax({ url: "/api/dados",
> success:
> >> function(dados) { // Atualizar a tabela com os dados recebidos
> $("#tabela
> >> tbody").html(dados); } }); }
> >
> >
> >
> > I want to add this script to the end of my page to keep updating.
> > Is it possible to do this, or is it better to put it in the html file?
>
>
> Something like this should work:
>
>
> Procedure UpdateTable;
>
>      procedure AllOK(d : jsvalue);
>
>      begin
>        Jquery('#tabela tbody').html(d):
>      end;
>
> var
>    opts : TJSobject;
>
> begin
>    opts:=TJSObject.New;
>    opts['url']:='/api/dados';
>    opts['success']:=@AllOK;
>    JQuery.Ajax(opt);
> end;
>
> begin
>    UpdateTable;
> end.
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>
>
> ------------------------------
>
> End of Pas2js Digest, Vol 61, Issue 6
> *************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20230826/1b0a395f/attachment.htm>


More information about the Pas2js mailing list