【发布时间】:2012-08-06 19:42:00
【问题描述】:
我正在尝试使用“easy-comment”,但在设置相对路径时遇到了困难。
我原以为第一行会设置目录,这样第二次提到的路径就会假设它在同一个地方……但显然不是!
谁能帮忙?
设置:在单独的站点上运行此代码所在站点的简单评论
<script type="text/javascript" src="http://www.anotherwebsite.co.uk/easycomment/jquery.easy-comment.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#my-comment,#your-comment,#is-this-ok-comment,#news-ting").EasyComment({
path:"/easycomment/",
moderate:true,
maxReply:5
});
});
</script>
我已尝试添加完整的 http:// 以第二次提及路径,但出现错误
XMLHttpRequest 无法加载 http://anotherwebsite.co.uk/easycomment/ec-comment.php。 Access-Control-Allow-Origin 不允许来源http://www.thiswebsite.com。
【问题讨论】:
-
不允许跨域AJAX
-
如果您可以控制远程服务器(anotherwebsite.co.uk 域),您可以设置 http 标头以接受来自您的第一个域的请求,否则您不能:它被禁止。
-
谢谢 Ricola,你能给我一个如何实现的例子吗?抱歉,这对我来说是全新的
-
Access-Control-Allow-Origin: * 现在添加了但是我收到了这个错误:GET anotherwebsite.co.uk/easycomment/jquery.easy-comment.js 500 (Internal Server Error) history-of-bristol.html:18 Uncaught TypeError: Object [object Object] 没有方法“EasyComment”
标签: javascript path relative-path