1

I am doing a request using jQuery:

$.get("http://nominatim.openstreetmap.org/search?q=" +
      searchValue + "&accept-language=hebformat=json&polygon='true'",
      {}, function (data)

where searchValue is the text string which I want to search for.

With Firefox this works perfectly and I am getting a JSON result and everything running smoothly. My application is nearly finished and I decided to run this on IE but I found that the request takes a lot of time and instead of getting a JSON result I get an error back.

What I can about this?

asked 31 Aug '10, 15:29

ItayEng's gravatar image

ItayEng
21113
accept rate: 0%

retagged 31 Aug '10, 17:17

twain's gravatar image

twain
2.4k2538


One Answer:
7

Nominatim expects parameters to be UTF-8 encoded and generates errors if the encoding is invalid.

Firefox correctly encodes parameters using UTF-8 encoding by default, but Internet Explorer doesn't, so you will need to explicitly encode it using the encodeURIComponent function. This will also work in Firefox and should work in other browsers.

$.get("http://nominatim.openstreetmap.org/search?q=" +
      encodeURIComponent(searchValue) + 
      "&accept-language=he&format=json&polygon=1",
      {}, function (data){});

You should also ensure that your page uses a UTF-8 encoding so that results can be properly displayed. This can be done by adding using a suitable meta tag in your <head> block:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
permanent link

answered 31 Aug '10, 16:50

twain's gravatar image

twain
2.4k2538
accept rate: 40%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×591
×50

question asked: 31 Aug '10, 15:29

question was seen: 7,722 times

last updated: 01 Sep '10, 07:23

powered by OSQA