-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
130 lines (112 loc) · 4.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/assets/plugins/bootstrap/css/bootstrap.min.css">
<title>Adres Kayıt Sistemi</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<div class="card mt-5">
<div class="card-body">
<h5 class="card-title">Adresler</h5>
<h6 class="card-subtitle mb-2 text-muted">NVİ Adres Kayıt Sistemi</h6>
<div class="form-group">
<label>Ülke</label>
<select name="country_id" id="country_id" class="form-control">
<option value="0"> - Ülke - </option>
</select>
</div>
<div class="form-group">
<label>Şehir</label>
<select name="city_id" id="city_id" class="form-control" disabled>
<option value="0"> - Ülke Seçiniz - </option>
</select>
</div>
<div class="form-group">
<label>İlçe</label>
<select name="county_id" id="county_id" class="form-control" disabled>
<option value="0"> - Şehir Seçiniz - </option>
</select>
</div>
<div class="form-group">
<label>Mahalle/Köy</label>
<select name="neighborhood_id" id="neighborhood_id" class="form-control" disabled>
<option value="0"> - İlçe Seçiniz - </option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="/assets/plugins/jquery/jquery-3.3.1.min.js"></script>
<script src="/assets/plugins/jquery/popper.min.js"></script>
<script src="/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script>
function getData(url, response, placeholder) {
response.html('<option value="0" selected> - LÜTFEN BEKLEYİNİZ... - </option>');
$.ajax({
type: "GET",
url: url,
cache: false,
dataType: 'html',
success: function(view) {
response.prop('disabled',false);
response.html('<option value="0" selected> - '+ placeholder +' - </option>');
var parse = JSON.parse(view);
$.each(parse, function(idx, obj) {
response.append($('<option>', {
value: obj.kimlikNo,
text : obj.bilesenAdi
}));
});
}
});
}
$(document).ready(function () {
$( "#country_id" ).change(function() {
var id = $(this).find(":selected").val();
var response = $("#city_id");
getData("/data.php?type=city&country_id="+id, response, 'Şehir Seçiniz');
$("#county_id").html("").prop('disabled',true);
$("#neighborhood_id").html("").prop('disabled',true);
});
$( "#city_id" ).change(function() {
var id = $(this).find(":selected").val();
var response = $("#county_id");
getData("/data.php?type=county&city_id="+id, response, 'İlçe Seçiniz');
$("#county_id").html("").prop('disabled',true);
$("#neighborhood_id").html("").prop('disabled',true);
});
$( "#county_id" ).change(function() {
var id = $(this).find(":selected").val();
var response = $("#neighborhood_id");
getData("/data.php?type=neighborhood&county_id="+id, response, 'Mahalle/Köy Seçiniz');
});
$.ajax({
type: "GET",
url: "/data.php?type=country",
cache: false,
dataType: 'html',
success: function(view) {
var parse = JSON.parse(view);
$.each(parse, function(idx, obj) {
$('#country_id').append($('<option>', {
value: obj.country_id,
text : obj.name
}));
});
}
});
});
</script>
</body>
</html>