Javascript fixes, works if request is on the same server (not cross domain)