javascript - JSONRequest.get unresponsive -


i trying send requests google places api code:

<script type="text/javascript" src="json2.js"> var googlequery; function load() {     googlequery = jsonrequest.get(          "https://maps.googleapis.com/maps/api/place/details/json?reference=3af0d044d45cd8587d9a3522bc98a95d4f60c6a8&sensor=true&key=xxxxxxxxxxxxxxxx",        function (googlequery, value, exception) {           if (value) {              processresponse(value);           }           else {              processerror(exception);           }        }     );  } </script> 

and calling load function in body onload.

  <body onload="load()">   </body> 

i including src="json2.js" in <script> instead of in own <script>, since getting "jsonrequest undefined" error...but still getting strange "load undefined" error.

am going json request correctly?

try:

<script type="text/javascript" src="json2.js"></script> <script type="text/javascript">     var googlequery;     function load(){     googlequery = jsonrequest.get(           "https://maps.googleapis.com/maps/api/place/details/json?reference=3af0d044d45cd8587d9a3522bc98a95d4f60c6a8&sensor=true&key=xxxxxxxxxxxxxxxx",      function (googlequery, value, exception) {         if (value) {             processresponse(value);         } else {             processerror(exception);         }       }     );     } </script> 

you can't have javascript code inside script tag has src attribute. should place inline code on script tag, otherwise won't executed.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -