AJAX cross domain xmlhttprequest issues

I

iannorton

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
 
B

bwucke

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?
 
V

VK

i'm just veryy unclear as to how i go about
transferring the JSON data without using xmlhttp.

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).
 
D

David Dorward

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

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

Thomas 'PointedEars' Lahn

VK said:
JSON is a *transport media* whilst XMLHttpRequest is the *transport*.

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
 
I

iannorton

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.
 
D

David Dorward

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

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.
Basically i need to make XMLHttpRequest calls across domains

You can't.
, i understand by using JSON i can do away with this,

You understand wrong.
all i was asking for is some pointers.

You got some.
 
I

iannorton

David said:
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.

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.
You can't.

But you could setup a Proxy or use Apache's rewrite engine....
You understand wrong.


You got some.

Just no need for histility, particularly this time of year...
 
T

Thomas 'PointedEars' Lahn

This better for you David?

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

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!
not all of us have decades of usenet experience,

And some of us appear to shut down their brains before they power on their
computer ...
i humbly apologise if my posting style has caused you offence.
ACK


But you could setup a Proxy or use Apache's rewrite engine....

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top