1

I have a wordpress page using ajax (a room booking system), and also a wordpress subdomain which is pointing to the page.

The main section of the page will not load when using the subdomain. The console error is

XMLHttpRequest cannot load http://mysite.co.uk/wp-admin/admin-ajax.php. Origin http://meetingroom.mysite.co.uk is not allowed by Access-Control-Allow-Origin.

I have tried to enable CORS for the subdomain but failed. In the subdomain folder on the server I have an index.php file to point to the room booking page. The code is as follows:-

<?php

$_GET['page_id']=2250;

define('WP_USE_THEMES', true);

require('../httpdocs/wp-blog-header.php');

The subdomain works very well except for the Access-Control-Allow-Origin error.

Can somebody help me to fix it? Thank you!

Lee Colarelli
  • 151
  • 2
  • 13

0 Answers0