Jump to content
Larry Ullman's Book Forums

Dynamically Update Google Map Based On User Query


Recommended Posts

Hi, I am using this extension to display the google map in my page. And i have a text field that have been adding dynamically. I want to display the text field values in the google map. How to pass the text field values into the google map functionality.

<div id="map_section">
    <div class="country_travell" style="background-color: #F8F8F8">
        foreach($countriesTravelled as $i => $countryTravelled) {
                $isCloseRequired = ($i==0) ? false : true;
                $this->renderPartial('_country_travelled', array('countryTravelled'=> $countryTravelled,
                        'i' => $i, // Row or iterator
        <div id="gmap">
                <?php $this->renderPartial('gmap',array('flagMap1'=>$flagMap)); ?>


<div class="floatLeft txt-input" rel="col1" style="width:150px;">
            echo $form->textField($countryTravelled, "[$i]place", array('onchange'=>'getPlaceName(this.value);', 'style' => 'width: 150px;'));


function getPlaceName(vl) {

                type: 'POST',
                url: '<?php echo Yii::app()->createUrl("site/showGmap"); ?>',
                        success:function(data) {
                                // alert(data);
                                // if success
                        jQuery("#gmap").load("<?php echo Yii::app()->createUrl('site/showGmap'); ?>");
                        error: function(data) { // if error occured
                        alert("Error occured...! Please try again");

                // $("#gmap").load("gmap.php");


public function actionShowGmap() {
        // echo $place; exit;
        [b]$this->render('gmap', array('place'=>$place));[/b]

In the controller i'm getting the value of place. and i want to pass the same place value in to the gmap.
Please anyone help me :(

Link to comment
Share on other sites


  • Create New...