Here is a simple example of how external data in different files can be called from outside in a single file on some action using Ajax technology. I am writing the code for 5 files. Just copy it. Create same file as mentioned below, named these accordingly paste data in and test it.
Send emails using PHP and AJAX. Its a complete AJAX PHP based email solution. Just download it and give it a try. Do not forget to change recipient’s email address in scripts/contact.php file and scripts/xmlHttpRequest.php file.
Ajax, or AJAX, is a web development technique used for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change. This is intended to increase the web page’s interactivity, speed, functionality, and usability.