Im trying to get the lat nad lng from a draggable marker from my controller,(我正在尝试从控制器的可拖动标记中获取经纬度,)
My Controller function(我的控制器功能)
public function addnew(){
// Load the library
$this->load->library('googlemaps');
// Load our model
$this->load->model('Sedes_model', '', TRUE);
// Initialize the map, passing through any parameters
$config['center'] = '-17.3718, -66.1615';
$config['zoom'] = "15";
$this->googlemaps->initialize($config);
// Get the co-ordinates from the database using our model
$sedes = $this->Sedes_model->getCoordanites();
// Loop through the coordinates we obtained above and add them to the map
foreach ($sedes as $row) {
$marker = array();
$marker['position'] = $row->location;
$this->googlemaps->add_marker($marker);
}
$marker = array();
$marker['position'] = '-17.3718, -66.1615';
$marker['draggable'] = true;
$marker['ondragend'] = 'alert('You just dropped me at: ' + event.latLng.lat() + ', ' + event.latLng.lng());';
$this->googlemaps->add_marker($marker);
// Create the map
$data = array();
$data['map'] = $this->googlemaps->create_map();
print_r($data['map']['markers']);
// Load our view, passing through the map data
$this->load->view('sedes/add_sede_view', $data);
}
with this i get my map with some markers from my database and also a draggable marker.(这样我就可以从数据库中获取带有一些标记的地图以及可拖动的标记。)
im trying to get the lat and lng from the marker to an input value in my view, right now i get the coordinates in the alert box.(我试图在视图中将纬度和经度从标记获取到输入值,现在我在警报框中获取了坐标。) I think i have to use javascript for this, but i don't really know much of it(我认为我必须为此使用javascript,但我并不是很了解)
I really appreciate any help with this.(我对此非常感谢。)
ask by J_Kohlberg translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…