Skip to main content
deleted 16 characters in body
Source Link
Boone Gorges
  • 3.5k
  • 1
  • 19
  • 14

Depending on how you're mapping somewebsite.com, you can probably just define ajaxurl differently:

var ajaxurl = '<?php echo 'http://www.somewebsite.com/admin-ajax.php' ?>';php';

If you need something more generalizable, you could filter admin_url, sniff out whether it's asking for admin-ajax.php, and if so, then rewrite it using home_url() or something like that.

Getting cross-domain ajax to work is possible (with a proxy approach, for instance) but it's best to avoid it if at all possible.

Depending on how you're mapping somewebsite.com, you can probably just define ajaxurl differently:

var ajaxurl = '<?php echo 'http://www.somewebsite.com/admin-ajax.php' ?>';

If you need something more generalizable, you could filter admin_url, sniff out whether it's asking for admin-ajax.php, and if so, then rewrite it using home_url() or something like that.

Getting cross-domain ajax to work is possible (with a proxy approach, for instance) but it's best to avoid it if at all possible.

Depending on how you're mapping somewebsite.com, you can probably just define ajaxurl differently:

var ajaxurl = 'http://www.somewebsite.com/admin-ajax.php';

If you need something more generalizable, you could filter admin_url, sniff out whether it's asking for admin-ajax.php, and if so, then rewrite it using home_url() or something like that.

Getting cross-domain ajax to work is possible (with a proxy approach, for instance) but it's best to avoid it if at all possible.

Source Link
Boone Gorges
  • 3.5k
  • 1
  • 19
  • 14

Depending on how you're mapping somewebsite.com, you can probably just define ajaxurl differently:

var ajaxurl = '<?php echo 'http://www.somewebsite.com/admin-ajax.php' ?>';

If you need something more generalizable, you could filter admin_url, sniff out whether it's asking for admin-ajax.php, and if so, then rewrite it using home_url() or something like that.

Getting cross-domain ajax to work is possible (with a proxy approach, for instance) but it's best to avoid it if at all possible.