Arduino Uno with Wifi_shield and Webserver issue

I’ve finally come to the point where I am well and truly stuck and require any assistance possible.

I’ve scrounged the following sketch from the web here http://startingelectronics.com/tutorials/arduino/ethernet-shield-web-server-tutorial/SD-card-AJAX-XML-web-server/
and have managed to get it working to a point.

The shield connects properly and serves the page (although a little slow for my liking).
Upon viewing the serial output, I see that the webpage sends a request to the Arduino every second and this is fine until you start clicking things…

Then, it all stops responding and I just can’t figure out why.
Any assistance would be fantastic.

I’ve attached the Sketch and webpage below.

index.htm (5.09 KB)

Webserver_Testing.ino (8.77 KB)

I think I figured it out!!!

I reckon the Arduino wasn't having enough time to reply to the webpage's 1 second requests so I changed the timeout to 5 seconds and now it seems stable!