NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi guys,

I'm trying to get search results from Nominatim in XML format. Here's my javascript code:

function requestToNominatim(){

    xmlhttp = getXMLHttpRequest();
    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
            var response = xmlhttp.responseXML;
            alert(response);
            }
    }

    var q = document.getElementById('q').value;
    xmlhttp.open("GET","http://localhost/nominatim/search.php?format=xml&q=" + q,true);
    xmlhttp.send(null);
}

The alert displays "[object Document]". However, when I display "responseText" I get the xml... Do you have any idea about getting directly the XMLDocument from responseXML?

Thanks! Lucas

asked 14 Jun '13, 14:42

Kalu06's gravatar image

Kalu06
1407815
accept rate: 0%

edited 17 Jun '13, 08:58

1

Finally, I ended up using JSON instead of XML. It's working as good and easier to manipulate.

Lucas

(17 Jun '13, 08:51) Kalu06

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×689
×193
×133
×84

question asked: 14 Jun '13, 14:42

question was seen: 3,716 times

last updated: 17 Jun '13, 08:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum