Php includes using ajax

I create a web page that is built using "modules", in other words, the page is combined using other php files.

On one side of my page there is a div container with some links next to it, this div container will be used to store certain information. The information is stored in separate php files, which I can’t load into the div container with the links mentioned earlier.

How do I do this with ajax?

Note. I upload php files with include ("");

+3
source share
3 answers

AJAX PHP include, , (, ).

PHP, , Prototype Ajax Updater.

, ; , PHP, , ; GET POST .

+8

AJAX - Javascript. jQuery

index.php:

<?php

// your main file
echo '<div id="module">Please wait while loading...</div>';
echo '<script type="text/javascript" src="jquery-1.3.2.js"></script>';
echo '<script type="text/javsacript">/* <![CDATA[ */';
echo '$(window).ready(function(){
         $("#module").load("module.php");
      });';
echo '/* ]]> */</script>';

?>

module.php:

<?php

echo 'Today is '.gmdate('l');

?>
+2

, div , prototype:

new Ajax.Updater('items', '/your_remote_script.php');
0

Source: https://habr.com/ru/post/1720352/