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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...