diff --git a/otanisys/db/maruike.sq3 b/otanisys/db/maruike.sq3 index e69de29..694f6a7 100644 --- a/otanisys/db/maruike.sq3 +++ b/otanisys/db/maruike.sq3 Binary files differ diff --git a/otanisys/maruike.cgi b/otanisys/maruike.cgi index 3922617..eef3c33 100755 --- a/otanisys/maruike.cgi +++ b/otanisys/maruike.cgi @@ -11,6 +11,7 @@ print "Content-type: text/plain; charset=UTF-8\n\n" + tag = c['tag'] @@ -18,10 +19,9 @@ db.busy_timeout = 1000 db.execute("CREATE TABLE IF NOT EXISTS name(tag text);") + db.execute("INSERT INTO name VALUES(?);", tag) +val = {'名前'=>tag} -val = {'タグ'=>tag} -val['名前'] = - db.execute("SELECT * FROM name) -puts JSON.pretty_generate(val) \ No newline at end of file +puts JSON.pretty_generate(val) diff --git a/otanisys/maruike.html b/otanisys/maruike.html index 2d1c70a..08363b8 100644 --- a/otanisys/maruike.html +++ b/otanisys/maruike.html @@ -20,7 +20,7 @@
-
名前:
+
diff --git a/otanisys/maruike_gps.js b/otanisys/maruike_gps.js index c45c1c5..45dd0fd 100644 --- a/otanisys/maruike_gps.js +++ b/otanisys/maruike_gps.js @@ -37,7 +37,7 @@ //gjl.on("ready", function() { // 'ready'ここでオブジェクトが中心になるように表示させる // marumap.fitBounds(gjl.getBounds()); // 読み取り失敗時は x3'error' イベント //}); - + gjl.addTo(marumap); L.control.layers(null, {"maruike": gjl}).addTo(marumap); @@ -139,16 +139,22 @@ //ajax的cgiの処理 一回封印する function dbAccess() { -//cgiからデータ受け取りのやつを書く + //cgiからデータ受け取りのやつを書く function respond(){ marumarker.setPopupContent("cgiからデータきたよ。書いてないけどね").openPopup(); - + if (this.readyState == 4) { // 4のときデータ受信完了 + //alert(this.responseText) + //console.log(responseText) + //var resp = JSON.parse(this.responseText); // 受信文字列取得(JSON) + //var resp = JSON(this.responseText); // 受信文字列取得(JSON) + alert("uwaaaaaaaaaa") + } } function submit() { // 「AJAX送信」ボタンを押したときの処 - var val = document.forms[0].elements['tag']; +// var val = document.forms[0].elements['val2']; var tag = document.getElementById('tag'); // 後で変える CGIに送るデータや送り先 - if (val) { + if (tag) { var conn = new XMLHttpRequest(); conn.open('POST', './maruike.cgi'); // POSTメソッドでCGIへ送る cgiファイルは実行権を与えること @@ -156,20 +162,17 @@ 'Content-Type', 'application/x-www-form-urlencoded'); // 送信データは 変数1=値1&変数2=値2... で送るが、 // 値の部分に&などが入ってもよいよう encodeURIComponent() する + alert(tag.value) conn.send('tag='+encodeURIComponent(tag.value)); conn.onreadystatechange = respond; // イベントリスナ登録 - } - + } } - //document.getElementById('send').addEventListener('click', submit); - //document.getElementById('stop').addEventListener('click', respond); - + document.getElementById('db').addEventListener('click', submit); } document.addEventListener('DOMContentLoaded', dbAccess) -document.getElementById('db').addEventListener('click', dbAccess); document.getElementById('send').addEventListener('click', start); document.getElementById('stop').addEventListener('click', tryWatchGPSstop);