timmah1 Posted June 11, 2012 Share Posted June 11, 2012 Can someone tell me why this isn't working? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <script language="Javascript" type="text/javascript"> //<! var center="Denver, CO"; var item="italian|restaurant"; var radius="10000"; var max_results="25"; var scriptname="places.php"; var map=null,markers=[],infowindow=null,refcache=[],detailcache=[]; function Initialize() { $.get(scriptname+'?search',{},function(data){ results=[]; try { eval('data='+data+';'); if (data.status=='OK' && data.results.length) { results=data.results; } gotGeocoder(data.location); } catch (e) {} gotResults(results); }); map = new google.maps.Map(document.getElementById('gmap_area'), { mapTypeControl: true ,mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR ,position: google.maps.ControlPosition.LEFT_TOP } ,zoom: 10 ,center: new google.maps.LatLng(0, 0) ,draggableCursor: 'crosshair' ,draggingCursor: 'pointer' ,panControl: true ,panControlOptions: {position: google.maps.ControlPosition.LEFT_CENTER} ,zoomControl: true ,zoomControlOptions:{position:google.maps.ControlPosition.LEFT_CENTER} ,overviewMapControl:true ,overviewMapControlOptions:{opened:false} ,disableDoubleClickZoom:true ,streetViewControl: true ,streetViewControlOptions:{position: google.maps.ControlPosition.LEFT_BOTTOM} ,styles: [{ visibility: "on" }] ,mapTypeId:google.maps.MapTypeId.HYBRID }); infowindow=new google.maps.InfoWindow(); } function gotGeocoder (geolocation) { map.setCenter(new google.maps.LatLng(geolocation.lat, geolocation.lng)); } function gotResults(results) { for(i=0;i<markers.length;i++) markers[i].setMap(null); var bounds=new google.maps.LatLngBounds(); var result_to_display=results.length; if (result_to_display>max_results) result_to_display=max_results; var html=''; for (i=0; i<result_to_display; i++) { var result = results[i]; html+='<div class="result">'; html+='<div class="result-name"><a target=_blank onmouseover="goToPlace('+"'"+result.reference+"'"+',this)">'+result.name+'</a></div>'; html+='<div class="vicinity">'+result.vicinity+'</div>'; html+='<div class="direction"><a target=_blank href="' +'https://www.google.com/maps?source=uds&daddr='+result.vicinity+'('+result.name+')@'+result.geometry.location.lat+','+result.geometry.location.lng+'&saddr='+center +'">direction</a></div>'; html+='</div>'; var options={ map:map ,position:new google.maps.LatLng(result.geometry.location.lat, result.geometry.location.lng) }; var marker=new google.maps.Marker(options); marker.content='<p>'+result.name+'</p><p>'+result.vicinity+'</p>'; bounds.extend(marker.getPosition()); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent( this.content ); infowindow.open(map,this); }); markers.push(marker); } $('#searchcontrol').html(html); if (results.length) map.fitBounds(bounds); } function gotReference (data,a) { var content=$(a).html(); var parent=$(a).parent(); parent.html('<a href="'+data.url+'" target=_blank>'+content+'</a>'); } function goToPlace (reference,a) { var index=refcache.indexOf(reference); if (index===-1) $.get(scriptname+'?reference='+reference,{},function(data){ result={}; try { eval('data='+data+';'); if (data.status=='OK' && data.result) { result=data.result; } refcache.push(reference); detailcache.push(result); } catch (e) {} gotReference(result,a); }); else { gotReference(detailcache[index],a); } } $(document).ready(function(){ Initialize(); }); //]]> </script> <style> .localexample{width: 40%;height: 100%;float: left;} .localexample strong{display: block;border-bottom: 1px dotted #ccc;margin-bottom: 20px;} #googleversion{margin-right: 50px;} #myversion{} #gmap_area {height:560px;} .gsc-resultsHeader,.gsc-above-wrapper-area,.gsc-control form,#searchresults {display:none;} .result {margin:8px 0px;} .result .result-name {font-weight:bold;color:blue;text-decoration:underline;cursor:pointer;} </style> </head> <body> <div id="googleversion" class="localexample"> <strong>Local Search</strong> <div id="searchcontrol" style="">Loading...</div> </div> <div id="myversion" class="localexample"> <strong>Map</strong> <div id="gmap_area"></div> </div> </body> </html> Everything works on one server, but not another. Thank you in advance Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/ Share on other sites More sharing options...
Mahngiel Posted June 11, 2012 Share Posted June 11, 2012 line 14, 43, and 177 Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1352913 Share on other sites More sharing options...
timmah1 Posted June 11, 2012 Author Share Posted June 11, 2012 Ok, I'm confused I see line 14 being :var max_results="25"; Line 43: ,draggingCursor: 'pointer' And i don't see line 177 line 14, 43, and 177 Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1352915 Share on other sites More sharing options...
timmah1 Posted June 13, 2012 Author Share Posted June 13, 2012 Could you please enlighten me about these lines? Like my previous post, I'm not understanding. Thanks line 14, 43, and 177 Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1353472 Share on other sites More sharing options...
Mahngiel Posted June 13, 2012 Share Posted June 13, 2012 What I'm saying to you is that you have not specified what the problem is. Based on your post count alone, I would expect you to be familiar with asking questions round here. What do you mean "isn't working" ? What do you expect? What errors? etc etc. Details chap. Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1353478 Share on other sites More sharing options...
ManiacDan Posted June 13, 2012 Share Posted June 13, 2012 1200+ posts and you still thought it was ok to dump 200+ lines on us without anything but "this broked"? Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1353492 Share on other sites More sharing options...
timmah1 Posted June 13, 2012 Author Share Posted June 13, 2012 Wow, ok, let's jump on me because I didn't "ask" the question right. I apologize for not stating the issue other than "this isn't working". The problem is, no results are showing. When it is on one server, results show, and the map gets populated. When we put it on the server that it is going to run on, no results show, and the map only shows the ocean. So with that being said, can anybody see why this code does not produce any results? Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/263993-google-places/#findComment-1353548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.