이학주

Modify variable names

......@@ -9,8 +9,8 @@ require('dotenv').config();
router.post('/', function(req, res) {
console.log(req.body);
let userSi = req.body.si
let userKu = req.body.ku;
let userLocation = `${userSi} ${userKu}`;
let userDong = req.body.dong;
let userLocation = `${userSi} ${userDong}`;
let xyList = [];
console.log(userLocation);
let YOUR_API_KEY = process.env.KAKAO_APIKEY;
......@@ -34,7 +34,7 @@ router.post('/', function(req, res) {
console.log(xyList);
}
})
res.render('select', { 'si': req.body.si, 'ku': req.body.ku });
res.render('select', { 'si': req.body.si, 'dong': req.body.dong });
});
module.exports = router;
\ No newline at end of file
......
......@@ -17,20 +17,20 @@ html
if (this.readyState == 4) {
var result = JSON.parse(this.responseText);
var d = [];
var c = [];
var dong_name = [];
var dong_code = [];
for(var i=0; i<result["admVOList"]["admVOList"].length; i++){
d.push(result["admVOList"]["admVOList"][i].lowestAdmCodeNm);
c.push(result["admVOList"]["admVOList"][i].admCode);
dong_name.push(result["admVOList"]["admVOList"][i].lowestAdmCodeNm);
dong_code.push(result["admVOList"]["admVOList"][i].admCode);
}
console.log(c);
var target = document.getElementById("ku");
console.log(dong_code);
var target = document.getElementById("dong");
target.options.length = 0;
for (x in d) {
for (x in dong_name) {
var opt = document.createElement("option");
opt.value = c[x];
opt.innerHTML = d[x];
opt.value = dong_code[x];
opt.innerHTML = dong_name[x];
target.appendChild(opt);
}
......@@ -99,8 +99,8 @@ html
</select>
</div>
<div class="form-group col-sm-4">
<label for="ku">동</label>
<select class="form-control" id="ku" name="ku">
<label for="dong">동</label>
<select class="form-control" id="dong" name="dong">
<option>선택해주세요.</option>
</select>
</div>
......
......@@ -5,7 +5,7 @@ html
button k
body
block content
h1 당신의 동네 : #{si} #{ku}
h1 당신의 동네 : #{si} #{dong}
.row
.col.s12.m7
.card(style='background-color: skyblue; display: inline-block;')
......