I have a very simple bit of code on a website
jQuery("#slist").load("sg-custom-code/SG-ajaxGetPastProds.php",{pd: jQuery(this).val()});
The path 'sg-custom-code' is off the root of the site. However the (Joomla) site uses SEO-friendly urls so it appends the apparent url of the page root (derived from the menu path) and tries to go to https://xxx.co.uk/everything-else/players/past-productions/sg-custom-code/.... and of course fails. The actual url should obviously be https://xxx.co.uk/sg-custom-code....
I can fix it by writing
jQuery("#slist").load("https://xxx.co.uk/sg-custom-code/SG-ajaxGetPastProds.php",{pd: jQuery(this).val()});
... but if a user then uses www.xxx.co.uk instead of xxx.co.uk it will fail with a CORS error!
Any ideas for how to work around this?
1.4m articles
1.4m replys
5 comments
56.9k users