Jump to content

AJAX http://domain.com vs www.domain.com


astralaaron

Recommended Posts

Hi, I am trying to search for information on this but am having trouble finding search words to bring up relevant info...basically what I just noticed... is if I type http://mydomain.com/ instead of http://www.mydomain.com/my AJAX calls do not work. when the www is added, they work fine. Can anyone explain why? and if there's a way to make sure the AJAX fires?EDIT:only tested in firefox btw.

Link to comment
Share on other sites

For security reasons, AJAX requests can only be done on the same domain as the page that's making the request. If your page is on www.mydomain.com then a request to domain.com won't work because it's considered a different domain.Besides redirection, you could also use the window.location object to see which domain your script is currently running in and use that one for the request.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...