get distance using google maps distance matrix api JSON output
<p>I developed the following code to get the distance of the given 2 cities through 2 textfields and i want to send them to google maps distance matrix api using the following URl. I send those cities and got the JSON output file. but my problem is how can i get the specific attribute(distance) from that JSON file and display on a another textfield. </p>

<pre><code>function m() {

            var x = document.getElementById("autocomplete").value;
            var y = document.getElementById("autocomplete1").value;

            var url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + x + "&amp;destinations=" + y + "&amp;key=AIzaSyD5KX6VRon6yQ0vu4s6GSnAVzazRWg8wrc";

window.location=url; // this will go to the above url and display the JSON output file on the browser. I dont want that to be shown. just some processing and should display only the distance form that file on a textfield!

}
</code></pre>

<p>the JSON output file <a href="http://pastebin.ca/3318529" rel="nofollow">http://pastebin.ca/3318529</a></p>

<p>Please help to solve this. i am new to JSON. So if you have any other ideas tell me. Many thanks :)</p>