Fix XHR issues jQuery Mobile is seeing

Fixed #1850 

See individual commits for details.

I need to sanity check XHR calls (and probably document!).