Skip to content
Advertisement

Change Website Content with PHP and AJAX Without Page Reload

A server process changes the content of a file readme.txt which is located in a users home directory (Linux Ubuntu 20.04 Server). I want to reflect the file content on the page without fully reloading the site. Therefore I tried AJAX in the index.php file:

JavaScript

Shouldn’t an AJAX GET request to the PHP file itself load the new content and display it on the page?

Advertisement

Answer

reader.php

JavaScript

So basically after clicking the Read me button, the div with id read will be filled with the txt content

index.php

JavaScript

there are many other solutions for this

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement