[Solved] Get latlng and draw a polyline between that two latlng


/*This is script*/ 

    var x=0;
    var map;
    var prepath;
    var path = null;
    var current_lat = 28.6667;
    var current_lng = 77.2167;
function initialize() {
  var myLatLng = new google.maps.LatLng(28.6667, 77.2167);
  var mapOptions = {
    zoom: 3,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
    //alert("sdf")  

google.maps.event.addListener(map, "click", function (e) {  
    //delete old
        //alert("sdf123")
    prepath = path;
    if(prepath){
        prepath.setMap(null);
    }   
    current_lat = e.latLng.lat();
    current_lng = e.latLng.lng();

    var flightPlanCoordinates = [               
            new google.maps.LatLng(39.9100, 116.4000),              
            new google.maps.LatLng(35.6833, 139.7667)               
    ];
    var polyline;   
    polyline = new google.maps.Polyline({
        path: flightPlanCoordinates,
        strokeColor: "#FF0000",
        strokeOpacity: 1.0,
        strokeWeight: 2
    }); 
    //new polyline
    polyline.setMap(map);   
    // assign to global var path
    path = polyline;
    });

}


google.maps.event.addDomListener(window, 'load', initialize);


/*this is html*/

<div id="map-canvas"></div>
    <div id="textboxContainer" style="width:100%; height:40px; top:0; position:absolute;">
        From : <input type="text" name="travelFrom" id="travelFrom"> &nbsp; To : <input type="text" name="travelTo" id="travelTo" onBlur="getRoute()">
    </div>

1

solved Get latlng and draw a polyline between that two latlng