开发者

getting xml cross site by using iframe

开发者 https://www.devze.com 2023-01-04 12:51 出处:网络
I am trying the above mentioned, like this: $.ajax({ type: \'GET\', dataType: \'xml\', url: $(\'#proxy\').attr(\'src\', \'http://192.168.0.106:8111/getconfiguration?\'),

I am trying the above mentioned, like this:

$.ajax({
                    type: 'GET',
                    dataType: 'xml',                  
                    url: $('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'),
                    success: function (xml) 
                 {//do stuff with xml

And in the body of my html page, i have a iframe like this:

<div><iframe 开发者_运维知识库id="proxy" src="" ></iframe></div>

It is hitting server and the server is returning the xml, but nothing happens. It seems to keep trying to process the xml. The error console in safari says:

Resource interpreted as other but transferred with MIME type text/html.

Any ideas, hints, things to try out??


Tried changing this:

var myxml = new String($('#proxy').attr('src', 'http://192.168.0.106:8111/getconfiguration?'));


$.ajax({
                    type: 'GET',
                    dataType: 'xml',                  
                    url: myxml,
                    success: function (xml) 

but that didn´t wotk either - or am i doing this wrong? I am new at JS


Shouldn't the url property return a string.

From what I can tell, it will return a jQuery object here.

You probably want to set the URL just to http://192.168.0.106:8111/getconfiguration?, as the code you are using is setting the src attribute, but it won't be returning anything useful in that context

0

精彩评论

暂无评论...
验证码 换一张
取 消