Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #22947

Re: php e ajax (elementare)

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Alessandro Pellizzari <shuriken@amiran.it>
Newsgroups it.comp.www.php
Subject Re: php e ajax (elementare)
Date Sun, 24 Oct 2021 10:02:28 +0100
Lines 41
Message-ID <itklp4Fatr6U1@mid.individual.net> (permalink)
References <skj7co$13sf$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace individual.net cYw0f5GUYqAa4i1g+zayywrBJBwe0rmtaLvc+lHBgbnJDhVS0=
Cancel-Lock sha1:T6N0x+5JkVIvH64n6wY+YbxL0+A=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0
In-Reply-To <skj7co$13sf$1@gioia.aioe.org>
Content-Language en-GB
Xref csiph.com it.comp.www.php:22947

Show key headers only | View raw


On 18/10/2021 08:23, cb wrote:

> Chiedo pazienza a tutti, ma sto provando ad usare ajax.
> Il mio primo tentativo di chiamare php da una pagina html e' qui sotto
> (scopiazzando e modificando l'esempio da w3school e da altri tutorial 
> sul web)

Ti consiglierei allora di lasciar perdere quel tutorial e quelli simili,
a meno che tu non deva supportare Internet Explorer per qualche motivo.

I browser si sono un po' evoluti rispetto a 10-15 anni fa.

Il modo "moderno" di fare quello che stai facendo รจ simile a questo:

<html>
<head></head>
<body>
  <div>
    <span id="dataGiorno">
       <form action="">
          <input type="button" id="btnData" value="click">
       </form>
    </span>
  </div>
  <script>
    document.getElementById('btnData')
      .addEventListener(
        'click',
        e => {
          e.preventDefault()
          fetch('lista.php')
            .then(res => res.text())
            .then(text => {
              document.getElementById('dataGiorno').innerHTML = text
            })
        },
      )
  </script>
</body>
</html>

Back to it.comp.www.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

php e ajax (elementare) cb <cb@ppt.io.it> - 2021-10-18 09:23 +0200
  Re: php e ajax (elementare) pippo <pippo@invalid.it> - 2021-10-19 12:25 +0200
    Re: php e ajax (elementare) cb <cb@ppt.io.it> - 2021-10-19 12:53 +0200
      Re: php e ajax (elementare) Leonardo Serni <lserni@gmail.com> - 2021-10-19 23:02 +0200
        Re: php e ajax (elementare) cb <cb@ppt.io.it> - 2021-10-20 08:09 +0200
          Re: php e ajax (elementare) Leonardo Serni <lserni@gmail.com> - 2021-10-20 08:58 +0200
      Re: php e ajax (elementare) pippo <pippo@invalid.it> - 2021-10-21 05:15 +0200
  Re: php e ajax (elementare) Alessandro Pellizzari <shuriken@amiran.it> - 2021-10-24 10:02 +0100
    Re: php e ajax (elementare) pippo <pippo@invalid.it> - 2021-10-24 13:00 +0200
      Re: php e ajax (elementare) Alessandro Pellizzari <shuriken@amiran.it> - 2021-10-24 12:40 +0100

csiph-web