Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery,访问不同的jQuery文件时阻止跨源请求_Javascript_Jquery - Fatal编程技术网

Javascript jQuery,访问不同的jQuery文件时阻止跨源请求

Javascript jQuery,访问不同的jQuery文件时阻止跨源请求,javascript,jquery,Javascript,Jquery,我有一个小jQuery脚本,当页面刷新时,它会随机化我的div jQuery(document).ready( function ($) { jQuery("div.band").randomize("", "div.pickle"); }); (function ($) { $.fn.randomize = function (tree, childElem) { return this.each(function () {

我有一个小jQuery脚本,当页面刷新时,它会随机化我的div

jQuery(document).ready(
    function ($) {
        jQuery("div.band").randomize("", "div.pickle");
    });
(function ($) {
    $.fn.randomize = function (tree, childElem) {
        return this.each(function () {
            var $this = $(this);
            if (tree) $this = $(this).find(tree);
            var unsortedElems = $this.children(childElem);
            var elems = unsortedElems.clone();
            elems.sort(function () {
                return (Math.round(Math.random()) - 0.5);
            });
            for (var i = 0; i < elems.length; i++)
                unsortedElems.eq(i).replaceWith(elems[i]);
        });
    };
})(jQuery);
jQuery(文档)。准备好了吗(
函数($){
jQuery(“div.band”).randomize(“div.pickle”);
});
(函数($){
$.fn.randomize=函数(树,子元素){
返回此。每个(函数(){
var$this=$(this);
if(tree)$this=$(this).find(tree);
var unsortedems=$this.children(childElem);
var elems=unsortedlems.clone();
元素排序(函数(){
return(Math.round(Math.random())-0.5);
});
对于(变量i=0;i
但是,当我尝试将collorbox与此脚本一起使用时,我收到一个跨源请求被阻止(原因:CORS标头“Access Control Allow Origin”丢失)

如果没有jQuery脚本,它就可以完美地工作。它看起来也不会将设置发送到collorbox jQuery文件。这些文件都位于同一服务器上,但不在同一映射中。我在这个网站上使用了wordpress

此外,这个collor框使用iframe来呈现页面,我试图呈现的网站上没有x-frame保护

它使用wordpress在jQueryCoppy中自己的构建来实现这一点

以下是随机发生器的工作链接
这里还有我使用的jQuery colerbox的链接

这是我用来调用wp中collor框的代码

<div class="band">
    <div class="pickle">
        <a class="wp-colorbox-iframe cboxElement" href="www.oldvic.nl">
            <img class="test" src="http://s.wordpress.com/mshots/v1/http%3A%2F%2Foldvic.nl?w=1920" alt="oldvic" /><br />
        </a>
        <header class="upper">
            <h3 class="under">oldvic</h3>
        </header>
    </div>
    <div class="pickle">
        <a class="wp-colorbox-iframe cboxElement" href="www.belder-schoenen.nl">
            <img class="test" src="http://s.wordpress.com/mshots/v1/http%3A%2F%2Fbelder-schoenen.nl?w=1920" alt="belder-schoenen" /><br />
        </a>
        <header class="upper">
            <h3 class="under">belder-schoenen</h3>
        </header>
    </div>
    <div class="pickle">
        <a class="wp-colorbox-iframe cboxElement" href="http://www.soeterboekschoenen.nl/">
            <img class="test" src="http://s.wordpress.com/mshots/v1/http%3A%2F%2Fsoeterboekschoenen.nl/?w=1920" alt="soeterboekschoenen" /><br />
        </a>
        <header class="upper">
            <h3 class="under">soeterboekschoenen</h3>
        </header>
    </div>
</div>

奥尔德维奇
贝尔德·肖恩
苏特博克肖宁

发出了什么请求?请求在哪里?为了更好地理解,请提供一个工作演示(代码片段、JSFIDLE…)