google maps API v3 doen't respond
<p>I'm new here.
I'm trying to make an application that calculates distance and driving time between two adresses using google maps API.</p>

<p>My problem is that google DirectionsService() doesn't seem to respond. and I can't figure it out. I have been trying to figure it out for one week now. </p>

<p>I hope you guys can help.
the problems seems to be in gmapApi.js</p>

<p>here is my code.<br>
Default.aspx</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"           Inherits="_Default" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
&lt;title&gt;&lt;/title&gt;
&lt;script type="text/javascript"&gt;
    function postbackObj() {
        var orig = document.getElementById('&lt;%= txbOrigin.ClientID %&gt;').value;
        var dist = document.getElementById('&lt;%= txbDestination.ClientID %&gt;').value;
        var temp = showLocation(orig, dist);
        __doPostBack('gmAPIObj',temp);
    }
&lt;/script&gt;
    &lt;script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"&gt;&lt; /script&gt;
    &lt;script type="text/javascript" src="gmapApi.js"&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;asp:TextBox ID="txbOrigin" Text="" runat="server" /&gt;
&lt;asp:TextBox ID="txbDestination" Text="" runat="server" /&gt;
&lt;asp:Button ID="btnSubmit" runat="server" Text="Search" OnClientClick="postbackObj()"/&gt;    

&lt;p&gt;
    &lt; asp:Label runat="server" ID="lblPrint" /&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt; 
</code></pre>

<p>gmapApi.js</p>

<pre><code>function showLocation(orig, dist) {
var directionService = new google.maps.DirectionsService();
var t = "";
var request = {
    origin: orig,
    destination: dist,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
};


directionService.route(request, function (response, status) {
    if (status != google.maps.DirectionsStatus.OK) {
        alert(status + "  \nreq. failed.");
    }
    else {
        t = request.origin + ';' + request.destination + ';' +  response.routes[0].legs[0].distance.value + ';' + response.routes[0].legs[0].duration.value;
    }
});

return t;
}
</code></pre>

<p>the response variable is null and the status variable is emptystring in the directionService.route(request, function (response, status)
I have tried to change  to  without lock. And I have tried to place the  tags in the body tag without lock.</p>

<p>the rendered html code.    </p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;&lt;title&gt;

&lt;/title&gt;
&lt;script type="text/javascript"&gt;
    function postbackObj() {
        var orig = document.getElementById('txbOrigin').value;
        var dist = document.getElementById('txbDestination').value;
        var temp = showLocation(orig, dist);
        __doPostBack('gmAPIObj',temp);
    }
&lt;/script&gt;
    &lt;script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="gmapApi.js"&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;form method="post" action="Default.aspx" id="form1"&gt;
&lt;div class="aspNetHidden"&gt;
&lt;input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /&gt;
&lt;input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /&gt;
&lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MjMyMzMwNTZkZHxi8IJlhy7bL8nAZqZfL2Vh4Yr8uF80ja6jX9Ypc87B" /&gt;
&lt;/div&gt;

&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
}
}
//]]&gt;
&lt;/script&gt;


&lt;div class="aspNetHidden"&gt;

&lt;input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"   value="/wEWBALsorucDwLTmobsAwK0weWLAwLCi9reA32PxME86E6mQhRTgBkF7cdktbiURIpf/IzKvAs5PHwI" /&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input name="txbOrigin" type="text" value="tilst" id="txbOrigin" /&gt;
&lt;input name="txbDestination" type="text" value="aarhus" id="txbDestination" /&gt;
&lt;input type="submit" name="btnSubmit" value="Search" onclick="postbackObj();" id="btnSubmit" /&gt;    

&lt;p&gt;
    &lt;span id="lblPrint"&gt;&lt;/span&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>thanks in advance. </p>
