使用iframe跨站点获取xml
我正在尝试上面提到的,就像这样:使用iframe跨站点获取xml,xml,iframe,xss,Xml,Iframe,Xss,我正在尝试上面提到的,就像这样: $.ajax({ type: 'GET', dataType: 'xml', url: $('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'), success: function (
$.ajax({
type: 'GET',
dataType: 'xml',
url: $('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'),
success: function (xml)
{//do stuff with xml
<div><iframe id="proxy" src="" ></iframe></div>
在我的html页面主体中,我有一个iframe,如下所示:
$.ajax({
type: 'GET',
dataType: 'xml',
url: $('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'),
success: function (xml)
{//do stuff with xml
<div><iframe id="proxy" src="" ></iframe></div>
有什么想法、提示、尝试的东西吗
尝试更改此选项:
var myxml = new String($('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'));
$.ajax({
type: 'GET',
dataType: 'xml',
url: myxml,
success: function (xml)
但这也没起作用——或者我做错了?
我是JS新手,
url
属性不应该返回字符串吗
据我所知,它将在这里返回一个jQuery对象
您可能只想将URL设置为
http://192.168.0.106:8111/getconfiguration?
,因为您使用的代码正在设置src
属性,但它不会返回在该上下文中有用的任何内容将myxml
更改为http://192.168.0.106:8111/getconfiguration?
。但是如果您只想更改iframe
的值,那么一行就足够了。