访问受限制的URI被拒绝code:1012 [英] Access to restricted URI denied code: 1012

查看:417
本文介绍了访问受限制的URI被拒绝code:1012的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你怎么解决这个Ajax的跨站点脚本问题得到Firefox 3的?

How do you get around this Ajax cross site scripting problem on FireFox 3?

推荐答案

如果您正在使用jQuery它有一个回调函数来解决这个问题:

If you're using jQuery it has a callback function to overcome this:

<一个href="http://docs.jquery.com/Ajax/jQuery.ajax#options">http://docs.jquery.com/Ajax/jQuery.ajax#options

在jQuery 1.2中,可以加载JSON   位于如果另一个域数据   指定JSONP回调,它可以是   像这样做:myurl回调=?。   jQuery将自动替换?   与调用正确的方法名,   调用你指定的回调。要么,   如果将数据类型设置为JSONP一   回调函数会被自动添加   您的Ajax请求。

As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. Or, if you set the dataType to "jsonp" a callback will be automatically added to your Ajax request.

另外,你可以让你的Ajax请求由它来完成跨域调用你的服务器端脚本,然后把数据传回你的脚本

Alternatively you could make your ajax request to a server-side script which does the cross-domain call for you, then passes the data back to your script

这篇关于访问受限制的URI被拒绝code:1012的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆