-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreate.cshtml
80 lines (65 loc) · 2.37 KB
/
Create.cshtml
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
@model WebUi.Services.CustomerAddress.CustomerAddressMvcRequestModel
@{
ViewData["Title"] = "Create";
}
<article>
Enter Chicago as the city and tab away to see the weather.
</article>
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="StreetAddress" class="control-label"></label>
<input asp-for="StreetAddress" class="form-control" />
<span asp-validation-for="StreetAddress" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="City" class="control-label"></label>
<input asp-for="City" class="form-control" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
<span id="weather"></span>
<div class="form-group">
<label asp-for="State" class="control-label"></label>
<input asp-for="State" class="form-control" />
<span asp-validation-for="State" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Zip" class="control-label"></label>
<input asp-for="Zip" class="form-control" />
<span asp-validation-for="Zip" class="text-danger"></span>
</div>
<span id="weather"></span>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#City').on('focusout',
function () {
if ($('#City').val() === 'chicago') {
//alert('q');
getChicagoWeather();
}
});
});
function getChicagoWeather() {
//alert('here');
$.get('@Url.Action("GetChicagoWeather", "ChicagoWeather")',
function (response) {
//alert(response);
$('#weather').html(response);
});
}
</script>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}