Hello,
I have implemented Address AutoComplete functionality that works really well using this:
jQuery.post('maps.googleapis.com/.../json{' + searchString + '}&types=address&language=en&crossDomain=true&key=[ourkey]', function (addresses) {
try {
//Rewrapp address in CRM Results object
resultSet.results = new Array();
addressesFound = [];
//break;
if (addresses['predictions'].length > 0) {
for (var i = 0; i < addresses['predictions'].length; i++) {
addressesFound.push({
id: addresses['predictions'][i].place_id,
fields: [addresses['predictions'][i].description]
});
}
resultSet.results = addressesFound;
}
if (resultSet.results.length > 0) {
ext.getEventSource().showAutoComplete(resultSet);
} else {
ext.getEventSource().hideAutoComplete();
}
}
catch (e) {
alert("AutoComplete ErrorInt: " + e.message);
}
});
Problem we're have now is that IE browsers need to have "Access Data Sources Across Domains" ENABLED.
This does not fit into our corporate security policy.
I've tried using this:
var xhr = XMLHttpRequest();
xhr.onreadystatechange = HandleAddressesReturned;
xhr.open('GET', 'maps.googleapis.com/.../json{' + searchString + '}&types=address&language=en&crossDomain=true&key=[Ourkey]');
xhr.send(null);
But I'm not seeing any data come back from Google. I'm sure I've made an error in implementation but cannot see what.
The callback function is this:
function HandleAddressesReturned() {
try {
if (xhr.readyState == 4) {
var addresses = xhr.responseText;
//DO SOME ADDRESS SELECTION HANDLING HERE
}
}
catch (e) {
alert("AutoComplete ErrorInt: " + e.message);
}
}
Can anyone point me in the right direction to negate the CORS issues restricting this functionality in IE?
Thanks!
*This post is locked for comments
I have the same question (0)