Please be aware that any loading issue can make many things fail. Sometimes, only a single issue is the problem and when that is tracked down, then everything may work as expected. If you are connecting to an online database using PHP or some other scripting language, this is the first place that I would look at.
I am working on a large XML/ToolBook project which works fine in XAMPP. There are virtually no ToolBook actions except to load an XML file for each page. But in order to successfully migrate this, I realize that the database must migrate FIRST and successfully. When a connection fails and data is not returned as expected to the calling application, then a lot of cascade failures can occur. It is a good idea to build into the load process, some application flexibility so if something doesn't connect or work as expected the application will generate feedback to you. In my case, when the application loads, it has to verify account details for the user BEFORE it reaches the actual login page.
So basically, take a close look at each step in the load process. A web server will always be a little slower at providing resources than XAMPP because XAMPP is running from your local system. If some of your resources are loading asynchronously (rather than strictly inline), than you must allow for this. When you say variables are undefined and XML files are not loading correctly or at all, it sounds like dependencies that some of these resources depend on are not available at the time expected in the load process. In today's web apps, loading most things asynchronously is the recommended approach, but you must be careful not to expect something to exist and be available when in fact it may or may not be.
Generally, ToolBook and Javascript load inline (or synchronous). XML on the other hand allows for huge flexibility by loading its resources asynchronously. This means that several connections are made to the web server all at once. While this speeds things up, it also means that small files will finish loading before larger ones. So you must be careful as functions written in your XML files may be expecting things from other XML files that haven't yet become available in the DOM.
To solve loading issues with asynchonous files I often use the <config2> ... </config2> section of the XML file to check dependencies before allowing any function to actually execute. Lets say for example you are connecting to a database and once a value is returned it will be stored in a global variable [db] and hold the string "connected". Then, just in case this variable has not been populated you should check for it in your XML <config2> section like this:
<config2 delay="500">
<exeJavascriptDirect>
<![CDATA[
/* CLIFTON: Check if database has connected.
***/
var fct = function() {
if (typeof db != "undefined" && db == "connected") {
[ do some stuff because our variable indicates db has connected ]
} else setTimeout(fct, 200); //Wait 200ms and check again
};
fct(); //Begin looping our function and checking for resources
]]>
</exeJavascriptDirect>
</config2>
Another approach is to use the
notifyObject parameter of PowerPac's
XMLHttpRequest() function to expressly send a user event a specific object which you know will always exist during the loading process. When the user event has been received, you can check for other dependencies or run other related functions that you know will work once the XML file has loaded and sent the user event to the specified object. This is the method that I usually use as it is the most reliable. I would not recommend using your own
XMLHttpRequest() as the one we've included with the PowerPac allows for a lot more flexibility and provides nice object notification (via user events).
If all of your files must be loaded synchronously or inline, the set the
notifyObject parameter in PowerPac's
XMLHttpRequest() to
false. I don't recommend this, but it will likely make things more predictable and your application will make single requests for resources and wait until they are received before moving on.
This is just a few things to consider that may help to track down the issue(s) you are having. Please remember, just one or two issues can result in the multitude of warnings and errors you are getting from your app. But they all stem from just one or two problems. A couple of alerts well positioned in the load process will likely help you identify those one or two issues.