김서연

검색결과 없을때 예외처리

1 +{
2 + // Use IntelliSense to learn about possible attributes.
3 + // Hover to view descriptions of existing attributes.
4 + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 + "version": "0.2.0",
6 + "configurations": [
7 + {
8 + "type": "pwa-chrome",
9 + "request": "launch",
10 + "name": "Open index.ejs",
11 + "file": "c:\\Users\\KSY\\Desktop\\4-1\\OpenSource\\Project\\views\\index.ejs"
12 + }
13 + ]
14 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
5 <title>코로나 백신 의료기관 조회</title> 5 <title>코로나 백신 의료기관 조회</title>
6 6
7 <!-- <link rel="stylesheet" href="/css/master.css"> --> 7 <!-- <link rel="stylesheet" href="/css/master.css"> -->
8 - 8 + <%if(typeof(info)!="undefined"){%>
9 + <script>
10 + try {
11 + if('<%=info%>'.length==0) throw new error();
12 + } catch (error) {
13 + alert("해당 지역 주변에 가능한 의료기관이 존재하지 않습니다.");
14 + location.href='/';
15 + }
16 + </script>
17 + <% }%>
9 </head> 18 </head>
10 <body> 19 <body>
11 <center> 20 <center>
...@@ -21,10 +30,12 @@ ...@@ -21,10 +30,12 @@
21 </p> 30 </p>
22 </form> 31 </form>
23 </center> 32 </center>
33 +
24 <div id="map" style="width:1300px;height:750px; margin-left:100px; float:left; " ></div> 34 <div id="map" style="width:1300px;height:750px; margin-left:100px; float:left; " ></div>
25 <script type="text/javascript" src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"></script> 35 <script type="text/javascript" src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"></script>
26 36
27 <% if(typeof(info) != "undefined"){ %> 37 <% if(typeof(info) != "undefined"){ %>
38 +
28 <div style="overflow:scroll; width:500px; height:675px; padding:10px;float:right; margin-right:70px; border:1px solid black;"> 39 <div style="overflow:scroll; width:500px; height:675px; padding:10px;float:right; margin-right:70px; border:1px solid black;">
29 <ol id="placelist"> 40 <ol id="placelist">
30 <% for(i=0; i<info.length; i++){%> 41 <% for(i=0; i<info.length; i++){%>
...@@ -50,11 +61,12 @@ ...@@ -50,11 +61,12 @@
50 <hr> 61 <hr>
51 </li> 62 </li>
52 <%} %> 63 <%} %>
53 - </ul> 64 + </ol>
54 </div> 65 </div>
55 <%} %> 66 <%} %>
56 67
57 <% if(typeof(result) != "undefined"){ %> 68 <% if(typeof(result) != "undefined"){ %>
69 +
58 <script> 70 <script>
59 var mapContainer = document.getElementById('map'), // 지도를 표시할 div 71 var mapContainer = document.getElementById('map'), // 지도를 표시할 div
60 mapOption = { 72 mapOption = {
...@@ -122,7 +134,7 @@ ...@@ -122,7 +134,7 @@
122 }; 134 };
123 } 135 }
124 </script> 136 </script>
125 -<% } %> 137 + <% } %>
126 138
127 </body> 139 </body>
128 </html> 140 </html>
...\ No newline at end of file ...\ No newline at end of file
......