baby machinery baby machinery - 3 months ago 28
jQuery Question

gmap not working on phalcon 3

im try to load gmap from phalcon 3, but first of it try to load and finally its disappearing. gray screen. i check it in console there it shows script error. how to solve? im using gmap.js. i also set maps height and width in css.

[controller]

class IndexController extends ControllerBase
{
public function initialize()
{
parent::initialize();
}
public function indexAction()
{
$this->tag->prependTitle('Welcome:: Anika Machinery');
$description = "index-desc";
$this->view->setVar("dynadesc", $description);
$keywords = "index-key";
$this->view->setVar("dynakey", $keywords);
$metaIndex = "index,follow";
$this->view->setVar("dynarobot", $metaIndex);
$this->view->setVar("dynagooglebot", $metaIndex);
}
public function contactAction()
{
$this->view->pick('index/contactus');
}
}


[views]

<div id="map"></div>

{{ javascript_include("http://maps.google.com/maps/api/js") }}
{{ javascript_include("js/gmaps.js") }}
{{ javascript_include("js/jquery-3.1.0.min.js") }}

<script defer>
var map;
$(document).ready(function(){
prettyPrint();
map = new GMaps({
div: '#map',
lat: -12.043333,
lng: -77.028333
});
});
</script>


[error]

enter image description here

Answer

everything is ok. just use javascript link like :

<script language="javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDWTQpi0GTmb6hoIjbBlcGYfZLAkaDmqLI&v=3"></script>

you should use api Key

Comments