Connecting Tech Pros Worldwide Forums | Help | Site Map

AJAX cross domain xmlhttprequest issues

iannorton@gmail.com
Guest
 
Posts: n/a
#1: Dec 22 '05
Hi there,

I Recently started experimenting with AJAX and succesfully created an
autocomplete box using a script that returned html from a serverside
javascript page.

I'm now at the point where i want to integrate it with an existing web
service.

I have 2 servers, the application's on one, and the data i need's on
the other, as xmlhttprequest doesn't work across domains what are my
options?

I've seen people mentioning JSON, i'm not clear how this works other
than the way the data's returned. Surely i'd still have to make the
xmlhttprequest call in the first place to request the data? Does anyone
know any good guides for autocomplete scripts using json.

My alternative is to use an Apache Proxy which seems the easiest
solution, but i'd like to experiment with JSON to see if it offers any
speed benefits, i'm just veryy unclear as to how i go about
transferring the JSON data without using xmlhttp.

Any pointers anyone?

Regards,

Ian


bwucke@gmail.com
Guest
 
Posts: n/a
#2: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues


Maybe open pages on both servers at once, say, one in a hidden frame,
then you should be able to transfer data between frames within one
browser window freely, and each frame would be able to make
xmlhttprequest calls to their respective servers?

VK
Guest
 
Posts: n/a
#3: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues



iannorton@gmail.com wrote:[color=blue]
> i'm just veryy unclear as to how i go about
> transferring the JSON data without using xmlhttp.[/color]

JSON is a *transport media* whilst XMLHttpRequest is the *transport*.
This forced symbiosis applies the same domain limitations on AJAX/JSON
as on AJAX only. The best minds like mine :-)) (just joking) are
working currently to get rid off outdated AJAX mechanics.

You may join to the brainsturming for your place in the Hall of Fame
(now serious).

David Dorward
Guest
 
Posts: n/a
#4: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues


bwucke@gmail.com wrote:
[color=blue]
> Maybe open pages on both servers at once, say, one in a hidden frame,
> then you should be able to transfer data between frames within one
> browser window freely[/color]

No, cross domain scripting security prevents mucking about with frames that
point to different domains just as much as it does with XMLHttpRequest.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
iannorton@gmail.com
Guest
 
Posts: n/a
#5: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues


So is there no way around XMLHttpRequest other than some type of proxy?

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#6: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues


VK wrote:
[color=blue]
> iannorton@gmail.com wrote:[color=green]
>> i'm just veryy unclear as to how i go about
>> transferring the JSON data without using xmlhttp.[/color]
>
> JSON is a *transport media* whilst XMLHttpRequest is the *transport*.[/color]

No. JSON is a data interchange format; XMLHttpRequest is the object or
design approach that tells the user agent to initiate a data transfer;
the transport media is the Internet (or any other abstraction layer);
the transport protocol is HTTP (or file:).


PointedEars
David Dorward
Guest
 
Posts: n/a
#7: Dec 22 '05

re: AJAX cross domain xmlhttprequest issues


iannorton@gmail.com wrote:
[color=blue]
> So is there no way around XMLHttpRequest other than some type of proxy?[/color]

If you replace "XMLHttpRequest" with "cross domain scripting" in that
sentence, then yes.

Now please read http://cfaj.freeshell.org/google/

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jasen Betts
Guest
 
Posts: n/a
#8: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues


On 2005-12-22, iannorton@gmail.com <iannorton@gmail.com> wrote:[color=blue]
> Hi there,
>
> I Recently started experimenting with AJAX and succesfully created an
> autocomplete box using a script that returned html from a serverside
> javascript page.
>
> I'm now at the point where i want to integrate it with an existing web
> service.
>
> I have 2 servers, the application's on one, and the data i need's on
> the other, as xmlhttprequest doesn't work across domains what are my
> options?[/color]

move the application, move the data, or program the application server to
retrieve the date from the data server.


Bye.
Jasen
iannorton@gmail.com
Guest
 
Posts: n/a
#9: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues


David,

Sadly not all of us are able to install whatever software we want.

Do you really have nothing else to moan about but the interface people
use to post newsgroup messages?

Basically i need to make XMLHttpRequest calls across domains, i
understand by using JSON i can do away with this, all i was asking for
is some pointers.

David Dorward
Guest
 
Posts: n/a
#10: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues


iannorton@gmail.com wrote:
[color=blue]
> Do you really have nothing else to moan about but the interface people
> use to post newsgroup messages?[/color]

I'm complaining about you failing to respect the conventions of this
community. The GoogleGroups interface makes it slightly difficult to do
this, but not impossible. You should therefore put in the little extra
effort required to do so. The page at the URL I referenced explains how to
do so. I suggest you read it again.

You are asking for help from this community, to not respect its posting
conventions is disrespectful.
[color=blue]
> Basically i need to make XMLHttpRequest calls across domains[/color]

You can't.
[color=blue]
> , i understand by using JSON i can do away with this,[/color]

You understand wrong.
[color=blue]
> all i was asking for is some pointers.[/color]

You got some.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
iannorton@gmail.com
Guest
 
Posts: n/a
#11: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues



David Dorward wrote:
[color=blue]
> iannorton@gmail.com wrote:
>[color=green]
> > Do you really have nothing else to moan about but the interface people
> > use to post newsgroup messages?[/color]
>
> I'm complaining about you failing to respect the conventions of this
> community. The GoogleGroups interface makes it slightly difficult to do
> this, but not impossible. You should therefore put in the little extra
> effort required to do so. The page at the URL I referenced explains how to
> do so. I suggest you read it again.
>
> You are asking for help from this community, to not respect its posting
> conventions is disrespectful.[/color]

This better for you David?

I've got no problem with you politely suggesting it, not all of us have
decades of usenet experience, i humbly apologise if my posting style
has caused you offence.
[color=blue]
>[color=green]
> > Basically i need to make XMLHttpRequest calls across domains[/color]
>
> You can't.[/color]

But you could setup a Proxy or use Apache's rewrite engine....
[color=blue]
>[color=green]
> > , i understand by using JSON i can do away with this,[/color]
>
> You understand wrong.
>[color=green]
> > all i was asking for is some pointers.[/color]
>
> You got some.[/color]

Just no need for histility, particularly this time of year...[color=blue]
>
> --
> David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
> Home is where the ~/.bashrc is[/color]

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#12: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues


iannorton@gmail.com wrote:
[color=blue]
> David Dorward wrote:[color=green]
>> iannorton@gmail.com wrote:[color=darkred]
>> > Do you really have nothing else to moan about but the interface people
>> > use to post newsgroup messages?[/color]
>>
>> I'm complaining about you failing to respect the conventions of this
>> community. The GoogleGroups interface makes it slightly difficult to do
>> this, but not impossible. You should therefore put in the little extra
>> effort required to do so. The page at the URL I referenced explains how
>> to do so. I suggest you read it again.
>>
>> You are asking for help from this community, to not respect its posting
>> conventions is disrespectful.[/color]
>
> This better for you David?[/color]

And for me, at the least.
[color=blue]
> I've got no problem with you politely suggesting it, [...][/color]

You must be kidding.

Who the heck do you think you are that others need to "politely suggest"
you would adhere to what is _common sense_, and what is written not only in
the FAQ? If you do not adhere after the pointer, you are simply not worth
the effort. He gave you enough pointers before, you should be ashamed that
it took you that many postings to recognize them!
[color=blue]
> not all of us have decades of usenet experience,[/color]

And some of us appear to shut down their brains before they power on their
computer ...
[color=blue]
> i humbly apologise if my posting style has caused you offence.[/color]

ACK
[color=blue][color=green][color=darkred]
>> > Basically i need to make XMLHttpRequest calls across domains[/color]
>> You can't.[/color]
>
> But you could setup a Proxy or use Apache's rewrite engine....[/color]

As previous discussions have shown, especially URL rewriting does not make
any difference to the script engine. What is possible is to set up a
server-side script that pulls the data using the other second-level domain
and serves that on requests for the appropriate second-level domain.


PointedEars
Douglas Crockford
Guest
 
Posts: n/a
#13: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues


> Basically i need to make XMLHttpRequest calls across domains, i[color=blue]
> understand by using JSON i can do away with this, all i was asking for
> is some pointers.[/color]

See http://crockford.com/javascript/script.html
iannorton@gmail.com
Guest
 
Posts: n/a
#14: Dec 23 '05

re: AJAX cross domain xmlhttprequest issues



Douglas Crockford wrote:
[color=blue][color=green]
> > Basically i need to make XMLHttpRequest calls across domains, i
> > understand by using JSON i can do away with this, all i was asking for
> > is some pointers.[/color]
>
> See http://crockford.com/javascript/script.html[/color]

Thank you Douglas,

Closed Thread