If our visitor's Internet connection fails, our script should tell them the Ajax will not work either.
Create a test script that makes an Ajax call. Ensure the call will fail by using a fake domain that will not resolve.
<form action="" method="get"> <input type="button" id="mybutton" value="Ajax!"/> </form> <script type="text/javascript"> var myJax = new Request({ url: 'http://incorrectdomain.com/nofileexists', onFailure: function() { alert('error connecting, Ajax call has failed :('); }, onSuccess: function(response) { alert('Success! Here is the response: '+response); } }); $('mybutton').addEvent('click', function ajax_it() { myJax.send(); }); </script>
Using a fake URL will create the same failure as a lack of Internet connectivity. The call cannot complete because it cannot contact the requested file for processing.