Because the ports are different, that qualifies as a cross-origin
call, and cross-origin calls are essentially disallowed because of the
Same Origin Policy[1].

You have a couple of options, both of which require specific support
on the server:

* You could have your web service support JSON-P[2], which works cross-

* If you're willing to limit use of your page to modern browsers and
do some fiddling for IE8 and above (IE7 and below won't work), you
could use the new Cross-Origin Resource Sharing standard[3]. This is a
new standard that allows cross-origin calls if the server authorizes
them. It's supported in modern browsers, although in IE you have to
use the special `XDomainRequest` object rather than the usual
`XMLHttpRequest` object used by Prototype's ajax stuff. (Other
browsers, like Firefox and Chrome, support CORS via `XMLHttpRequest`.)

[1] http://en.wikipedia.org/wiki/Same_origin_policy
[2] http://en.wikipedia.org/wiki/JSONP#JSONP
[3] http://www.w3.org/TR/access-control/

T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On May 18, 11:00 am, Gordon <gordon.mu...@gmail.com> wrote:
> Hallo together,
> I have some problems by calling a REST webservice with Ajax.Request. I
> already checked the service with Fiddler, so it should be working. the
> script runs on localhost:80 and the webservice on localhost:8732
> the result of transport.responseText is "" and my service is not
> called (I check that width debugging mode)
> Here some code:
> new Ajax.Request("http://localhost:8732/GetStuff";, {
>                         method: 'post',
>                         parameters: 'ID=12345',
>                         requestHeaders: {ContentType: "application/json"},
>                         encoding: 'UTF-8',
>                         onSuccess: function(transport) {
>                                 alert(transport.responseText);
>                                 var json = 
> transport.responseText.evalJSON(true);
>                                 alert(json);
>                         },
>                 });
> Hope that you can help
> best regards
> gordon

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to