2012-08-09 79 views
0

我正在尝试使用“简单评论”,但与它设置的相对路径挣扎。Javascript - 相对路径不正确?

我以为第一行会设置目录,以便第二次提到的路径会假设它在同一个地方..但显然不是!

任何人都可以帮忙吗?

设置:运行在一个单独的网站,该网站的代码是

<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

+3

跨域AJAX是不允许 – Austin 2012-08-09 14:37:59

+0

你可以设置http头来接受来自第一个域的请求,否则你不能:它被禁止。 – Ricola3D 2012-08-09 14:41:20

+0

谢谢Ricola,你能给我一个如何实现的例子吗?对不起,这对我来说都是新的 – flatcap 2012-08-09 14:53:01

回答

0

不允许跨域ajax。

如果您想要对其进行测试,您可以禁用chrome中的websecurity。

但你应该如果你有控制的远程服务器上(http://www.anotherwebsite.co.uk域)的路径更改为资源在服务器上

+0

doh thanks for the heads up :) – flatcap 2012-08-09 14:43:37

+0

我想要它的服务器运行不能运行PHP - 任何想法来获得这个工作的跨域或是100%否? – flatcap 2012-08-09 14:45:48

+0

不需要你的服务器上的PHP,也许你可以在你的服务器上使用不同的技术。 – Safari 2012-08-10 07:28:33