Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时当前域是 builds,有时是 builds.example.com。我想将 AJAX 请求调用到与当前域相同的域(这样它就不会违反同源策略)。如何找到当前域?如果这不可能,还有其他解决方案吗?
无需查找当前域。只需使用部分 URL:
new Ajax.Request("/partial-url-without-domain", { method: "post", parameters: parameters });