Sorry will have to log off soon so might not be able to respond very soon. I'll ask you this anyway.
What browser are you using? If you are using firefox, you may need this link:
How to fix ajax error
If that's not the case do you access the internet via a proxy? I know that sounds daft when you are accessing localhost, but my work pc needs to go through the proxy to access my localhost server. If this is the case, then the proxy may be returning the code as if it from the IP address even when you have localhost in the address bar. In which case, the quick solution is just to use the IP address.
Hope that is some help.