I tried the Access-Control in two servers of my own:
www.trusted-server.com:
var options = {
onSuccess: function(req) {
$("debug").insert(req.responseText);
},
onException: function(req, ex) { alert(ex); }
};
new Ajax.Request("http://external-server.com/test.php", options);
www.external-server.com/test.php:
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, OPTIONS');
header('Access-Control-Allow-Headers: x-prototype-version,x-requested-
with');
echo 'It works!';
?>
I'm cheking twitter and seems that the server doesn't send the "Access-
Control-Allow-Origin" nor "Access-Control-Allow-Headers", so maybe you
cannot apply the Access-Control policies in this case.
All the process is very well explained in
https://developer.mozilla.org/En/HTTP_access_control
On 17 ago, 14:31, Omar Adobati <[email protected]> wrote:
> Thanks for your answer, but I think I'm a bit confused.The remote server,
> i.e. would be the one I'm trying getting data from (i.e. twitter server).
> If I haven't misunderstood what are you saying, I should apply those headers
> to that server?
> Or Am I completely wrong? (which I hope to)
>
> Thanks again,
>
> ---
> Omar Adobati
>
> Sent from Düsseldorf, North Rhine-Westphalia, Germany
>
>
>
> On Mon, Aug 17, 2009 at 13:57, mmacia <[email protected]> wrote:
>
> > The script that processes the ajax request in the remote server must
> > set these headers. I can post a full example if you want.
>
> > On 17 ago, 13:53, Omar Adobati <[email protected]> wrote:
> > > What do you mean with "the server side"?Can you please clarify it to me?
>
> > > Thanks,
>
> > > Omar
> > > ---
> > > Omar Adobati
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---