Same browser (Safari.latest) on the same computer, the Prototype method gives
me a security failure (Origin [my host] is not allowed by
Access-Control-Allow-Origin.) while the long-hand XHR (inside a Prototype
observer) just works without any comment:
Prototype:
$('zip').observe('change',function(evt){
var elm = this;
new Ajax.Request('http://zip.elevenbasetwo.com', {
method: 'get',
parameters: {zip: $F(elm)},
onComplete: function(transport){
var data = responseText.evalJSON();
$('city').setValue(data.city);
$('state').setValue(data.state);
}
});
});
XHR:
$('zip').observe('change',function(evt){
var client = new XMLHttpRequest();
client.open("GET", "http://zip.elevenbasetwo.com?zip="; + $F(this), true);
client.onreadystatechange = function() {
if(client.readyState == 4) {
var data = client.responseText.evalJSON();
$('city').setValue(data.city);
$('state').setValue(data.state);
};
};
client.send();
});
I don't trust this to work in the range of browsers supported by Prototype,
naturally, so I'd really like to know what I could do to get it to work in
Prototype.
Thanks,
Walter
--
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
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.