Note that there are some explanatory texts on larger screens.

plurals
  1. POThe simplest (or at least the one functional) way to init JSON obejct from URL (Geocoding API)
    primarykey
    data
    text
    <p>Im trying to geocode in my javascript code against Geocoding API. I get url defined <code>var url = "http://http://maps.googleapis.com/maps/api/geocode/json?address=New York, Manhattan&amp;sensor=false" </code> from which I need to retrive a JSON object. First approach I used was according to Wikipedia using XmlHttpRequest like this</p> <pre><code>var my_JSON_object = {}; var http_request = new XMLHttpRequest(); http_request.open("GET", url, true); http_request.onreadystatechange = function () { var done = 4, ok = 200; if (http_request.readyState == done &amp;&amp; http_request.status == ok) { my_JSON_object = JSON.parse(http_request.responseText); } }; </code></pre> <p>I run the code and get such output in debugger after open() function was triggered:</p> <pre><code>http_request: XMLHttpRequest onabort: null onerror: null onload: null onloadend: null onloadstart: null onprogress: null onreadystatechange: function () { readyState: 1 response: "" responseText: "" responseType: "" responseXML: null status: [Exception: DOMException] statusText: [Exception: DOMException] upload: XMLHttpRequestUpload withCredentials: false __proto__: XMLHttpRequest </code></pre> <p>which means that nothing really useful obviously happened. My second approach was due to json.org, Ive tried to make a get call with JSONRequest</p> <pre><code>var requestNumber = JSONRequest.get( url, function (requestNumber, value, exception) { if (value) { document.write(value); } else { document.write(exception); } } </code></pre> <p>Debugger told me that JSONRequest is not defined! Due to json.org its native JS object so whats the problem? Just to notice, i use properly gained API key from google in the script nearby.</p> <p>Explanation why my solution failed and any suggestion how to comply with this task would be much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload