Improved reliablity of loading json and xml.

A question on StackOverflow suggested the setTimeout(send(), 0) thing.
Also added limited attempts to reload on a failure (although they
haven't seemed to have triggered).