I'm currently working on a setup where Server A (www.example.com) needs to send information to Server B. The catch is that only HTML / JS can be used on Server A, so all the data processing has to happen on Server B. My solution involves sending form data via AJAX instead of a traditional form post to Server B.
Now, I know that conducting an AJAX call across different domains is typically considered cross-site scripting (XSS) and not recommended. But I've been wondering - if I were to place Server B in a subdomain (sub.example.com), would that make it acceptable? How exactly are cross-domain errors detected by browsers? Do they use DNS records or IP addresses for this purpose?
Thank you in advance for any insights you can provide!