Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.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.getJSON和URL作为参数_Javascript_Jquery_Url - Fatal编程技术网

Javascript jQuery.getJSON和URL作为参数

Javascript jQuery.getJSON和URL作为参数,javascript,jquery,url,Javascript,Jquery,Url,我有一个jQuery代码 $.getJSON( "http://my.website.com/cors", { url: "https://www.someREST.com:8888/rest/v1", last: self.last(), first: self.first(), address: self.addres

我有一个jQuery代码

        $.getJSON(
        "http://my.website.com/cors",
        {
                url: "https://www.someREST.com:8888/rest/v1",
                last: self.last(),
                first: self.first(),
                address: self.address()
        },
            function (data) {
                console.log(JSON.stringify(data.entry));
       });
但是当我调用
getJSON
时,URL参数在每个斜杠上都添加了反斜杠,
encodeURIComponent()
这会让情况变得更糟


有什么建议吗?

根据您在那里所做的判断,我认为您指定的URL太多了

试着像这样重新格式化

$.getJSON("https://www.someREST.com:8888/rest/v1",
    {
        last: self.last(),
        first: self.first(),
        address: self.address()
    },
        function (data) {
        console.log(JSON.stringify(data.entry));
   });

我不是CORS的人,所以我不完全理解你最初的意图。

尝试使用
decodeURIComponent
?@PraveenKumar添加反斜杠到添加反斜杠或转义引号?它必须经过
http://my.website.com/cors
作为IE9的代理-由于Corthere的原因,其他方法不起作用其他不允许使用IE9类请求中的direct
getJSON
的因素必须针对与托管页面相同的方案(在本例中为HTTP vs HTTPS),这就是为什么必须通过“代理”应用程序调用它的原因。