Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit show #18

Merged
merged 1 commit into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion static/geojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function initialize() {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry":
"geometry":
{
"type": "LineString",
"coordinates": [
Expand Down Expand Up @@ -43,3 +43,23 @@ function initialize() {
map.data.addGeoJson(input_geojson); //geojson function
}
google.maps.event.addDomListener(window, 'load', initialize);

function Go(){
var start = $('#input1').val();
var end = $('#input2').val();
$.ajax({
url:"http://localhost:5000/"+start+"/"+end,
crossDomain: true,
type:"GET",
dataType:'json',
success: function(html) {
console.log(html);
alert(html['來源']);
alert(html['目的']);
},
error:function(html){
alert('error');
}
});

}
13 changes: 11 additions & 2 deletions templates/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="{{ url_for('static', filename='geojson.js') }}"></script>

</head>
<body>
<div id="googleMap" style="width:800px;height:600px;"></div>
<div style="float:left;width:100%;">
<div id="googleMap" style="float:left;width:800px;height:600px;width:70%;"></div>
<div style = "float:right;line-height:50px;text-align:center;width:30%;margin-top:450px;">
<form id="form" method="POST">
請輸入起點:<input type="text" name="欄位名稱" id= "input1"></br>
請輸入終點:<input type="text" name="欄位名稱" id= "input2"></br>
<button type="button" onclick="Go();" >傳送!</button>
</form>
</div>
</div>
</body>
</html>