how to update content automatically without reloading webpage using php/ajax?

前端 未结 3 1606
清酒与你
清酒与你 2021-01-14 04:04

I\'m trying to create an auction tool using PHP. The problem I\'m having (and I appreciate its a basic one but I need clarification) is that I don\'t understand how to updat

3条回答
  •  一整个雨季
    2021-01-14 04:23

    As I making interactive displays, which must switch pages instantly, then I create pages without refreshing.

    My approach is something like that:

    1. I have one index.html with all structure (pages) with all necessary html tags.
    2. javascript/typescript loads json from CMS (Kirby for example), which has all information about texts and image links.
    3. when json is loaded now I just need to switch between pages by showing/hiding or creating/removing html elements. And all data and texts are loaded by javascript.

    There is some cons, which can be fixed, for example link for each page in address bar. In that case You need to add history management and change url in address bar on page switch.

提交回复
热议问题