Correct SPSA plot order of events and handle preload and exceptions

This will ensure that Google libraries are loaded after the page loads to avoid noticeable slow down. Preload  and exception handling of ajax call are added to be more user-friendly.