> > > From: bratliff 
> > >
> > > Eliminating the use of proxies with a JSON interface 
> > > might appeal to some developers.

> > From: William
> >
> > Could you explain what you mean by "proxy" server in this
> > context? That's like another server standing between the
> > client browser and the server responsible for making a
> > Google Map Layer?

> From: bratliff
>
> Yes.
> 
> If I host an application on my server, it cannot send 
> XMLHttpRequests to your server because of cross domain 
> security.  It has to send XMLHttpRequests to my own server 
> which are repackaged & forwarded to your server.  Every round 
> trip involves four hops.  Using JSON, my application hosted 
> on my server can communicate directly with your server.  
> Every round trip involves two hops.  Also, JSON is fairly 
> compact compared to XML.
> 
> Some developers have neither the skills nor the privileges to 
> set up a proxy on their web host provider's server.

To be specific, what's required for this isn't plain JSON, but JSONP, which
is a JSON object wrapped inside a callback function so it is actually
executable JavaScript code. The name of the callback function is specified
in the URL for the data request, typically with a "callback=" parameter.

For example:

http://example.com/getjson?foo=bar&format=json

Could return standard JSON:

{ "test": "howdy" }

Adding a callback parameter:

http://example.com/getjson?foo=bar&format=json&callback=mike

Would return JSONP instead:

mike({ "test": "howdy" })

That is a JavaScript function call which is directly executable, unlike the
standard JSON which is not. Making it an executable function call is what
allows it to work cross-domain (since browsers allow scripts to be loaded
from any domain).

-Mike


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to