I’m implementing Yahoo Placefinder in my project, via a JSON request. This seems to work fine in Chrome/FF/Safari, however in Internet Explorer (all versions) it tires to download it rather than send a request back.
The standard JSON requset from the Placefinder API seems to have the same issue – http://where.yahooapis.com/geocode?location=San+Francisco,+CA&flags=J&appid=yourappid
This is part of the code I’m using in my project.
$.ajax({
type: "GET",
dataType: "json",
cache: false,
url: "http://where.yahooapis.com/geocode?location="+ address+ ","+ postcode+ "+UK&flags=J&appid=yourappid",.....
Why is IE trying to download this file? Any ideas how I can send the request back the same way as the other browsers?
Thanks in advance!
When You work with JSON and web services in IE the best practice is that you first encode your request url.
You can do that simple with that java script function:
sampleUrl = encodeURIComponent(address+ “,”+ postcode+ “+UK&flags=J&appid=yourappid”);
and then use sampleUrl parameter in call:
$.ajax({
type: “GET”,
dataType: “json”,
cache: false,
url: “http://where.yahooapis.com/geocode?location=” + sampleUrl
});
Best Regards.