Hello,

If you want to get files from another domain different than yours, it will fails ever..
Security issue..


----- Original Message ----- From: "jhm" <jmay...@gmail.com>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Sunday, June 28, 2009 9:42 AM
Subject: [jQuery] Re: .get() failing



Thank you. That explains it very well, and kind of what I expected.


On Jun 26, 12:13 pm, Zbyszek Matuszewski
<zbyszek.matuszew...@gmail.com> wrote:
Hi!

Try to debug your application with Firebug extension for Firefox.

You should probably get "uncaught exception: Access to restricted URI
denied" error when trying to access URL that is on other server than
the one script is working on (if it's not local file).

If that is the case it's security issue - you should receive files
from the same server as the script works from. Accessing other server
is cross site reference and AJAX doesn't allow cross site references.

There can be at least 3 solutions:
- you may use wrong address of actual site (for example scripts starts
from some.server.com when there iswww.some.server.comdomain), so you
should repair this (use relative URLs or make your server side
generate actual domain and put into script or make your client side
javascript get domain name from the actual URI)
- you may use some other server, so to do that you should write server
side code (for example with use of sockets in PHP) that will connect,
get XML and send it to your script (will work as a proxy, so the AJAX
call will be within same domain)
- you may try to make an IFRAME dynamically (hidden one) that will
load the data and then take the data from that IFRAME (very unclean
solution, but it should work, there are some well known scripts that
use similar approach to make an AJAX file uploader).

On 26 Cze, 20:19,jhm<jmay...@gmail.com> wrote:

> I posted this late last night, but got no responses. I thought maybe
> it scrolled off before anyone had a chance to see it, so I'm posting
> again. Sorry if this is bad form, I'm new to these groups...

> I'm having an issue with the $.get() method. When I request a file
> local to my site (with a relative path), everything works fine. When I
> request the same file with a full URL, the $.get() isn't successful. I
> don't know if its a security issue (requesting data from a 3rd party
> site) or maybe a timing issue, or maybe something else.

> Here's the essence of the call when it fails:

> $.get('http://files.myurl.com/myxml.xml', function
> (data) {
> alert('got it');
> }

> If I call it with just the 'myxml.xml' as the path, it works fine.

> Thanks!

Reply via email to