0

My website has two domain names that points to the same folder on my server.

I've implemented a module that uses AJAX and it works perfectly when I acces my website through www.domain1.com but fails when I access it through www.domain2.com.

I've looked around and I see a lot of post about cross domain AJAX and jsonp but I was wondering if there would be another option in my case.

Since it has technically the same origin, is there a way around this ?

Community
  • 1
  • 1

1 Answers1

2

What is the sense to have 2 domains names and absolutely the same content?

Anyway, you need just to use the same domain as initial page is loaded, so you will have no cross domain calls

Iłya Bursov
  • 23,342
  • 4
  • 33
  • 57
  • 2
    In other words, use a domain relative url. `url: "/somefolder/somefile.php"` – Kevin B Oct 21 '13 at 21:46
  • Thx for the answer. I have 2 domain names pointing to the same content because I manage 2 languages on the same website and there is a domain name per language. Does that make sense ? – Alexandre Lavoie Oct 22 '13 at 15:03
  • By curiosity, I've tried with a script that uses absolute urls and changes the url: "url" depending on the domain the request was sent from and it didn't work. Anyone knows why ? – Alexandre Lavoie Oct 22 '13 at 15:30
  • 1
    @AlexandreLavoie open browser's developer tools and check what requests are actually made – Iłya Bursov Oct 22 '13 at 16:32