[英]How to make cross domain request using ajax or javascript?
I have some Pre built script that makes some ajax request to one website. 我有一些预先构建的脚本,该脚本向一个网站提出了一些ajax请求。 And it's working fine.
而且工作正常。 But I am not able to make request to there some domains.
但是我无法向其中的某些域提出请求。
My working Process:- 我的工作流程:
1) I have pre built script on http://www.Test.com/a.js now i am calling this js in this domain http://www.test1.com by pasting the code to URL and it's working fine. 1)我已经在http://www.Test.com/a.js上预先构建了脚本,现在我通过将代码粘贴到URL在此域http://www.test1.com中将此js调用,并且可以正常工作。
2) Now When I want to call one page from This http://hello.test1.com/as.php but it's showing some errors. 2)现在,当我想从This http://hello.test1.com/as.php调用一个页面时,却显示了一些错误。 How could i make request to subdomain page from main domain page.
我如何从主域名页面向子域名页面发出请求。
Please let me know how can i do this. 请让我知道我该怎么做。
Thanks in advance. 提前致谢。
Your various options for cross-domain requests are: 跨域请求的各种选项是:
script
element script
元素 You can use php curl to do the cross domain request using ajax. 您可以使用php curl使用ajax进行跨域请求。 An ajax request will call php curl page which in turn will call cross domain with url specified in php curl page and return back the response .
一个ajax请求将调用php curl页面,该页面随后将调用php curl页面中指定的url的跨域并返回响应。
I have implemented same and it works fine. 我已经实现了相同,并且效果很好。 Hope this helps Thanks.
希望这对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.