Changes in php. Now uses the logfile.php for saving the xml to the database.
Gives the right XML with delays.
Changed the structure in the javaScript.