0

Can you help me to make request via ajax crossdomain?

what i have:

$.ajax({
        type: "POST",
        url: "/login.php",
        data: {
        email: document.loginform.email.value,
        password: document.loginform.password.value,
        }
      }).done(function(msg){});

i'm calling it FROM https://m.domain.com/login.php - it works. But, i want to call same script login.php which is on domain.com.

As you could guess i'm working on mobile version of website. i want make post requests from m.domain.com to scripts that is situated on domain.com

Using absolute address like: url: "https://domain.com/login.php", - no success..

i also tried make url like "/home/admin/web/domain.com/public_html/" for ajax request.. still no result..

WhoIsDT
  • 695
  • 2
  • 9
  • 27

1 Answers1

0

You should allow CORS for https://m.domain.com on https://domain.com/login.php.

like here

Community
  • 1
  • 1
LazyCat01
  • 957
  • 7
  • 23
  • So can you help me what i should do? add this on domain.com/login.php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *"); – WhoIsDT Apr 21 '16 at 19:10