-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_ip.js
More file actions
42 lines (29 loc) · 1011 Bytes
/
script_ip.js
File metadata and controls
42 lines (29 loc) · 1011 Bytes
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
$(document).ready(function () {
var newCity = null;
//event listener when city is entered
$("form").submit(function (event) {
event.preventDefault();
$("#cityName h2").empty();
//returns css properties to pre-ajax_error settings
$("#cityName").css({ "width": "20%", "background-color": "grey", "color": "black" });
$("#currentForecast .card-text:first").empty();
newCity = $("input").val().trim();
$("input").val("");
variableCityCurrentCall(newCity);
//displays ajax error as "location undefined"
$(document).ajaxError(function () {
$("#cityName h2").html("LOCATION UNDEFINED");
$("#cityName").css({ "width": "80%", "background-color": "black", "color": "red" });
cityPlacement = true;
});
cityIp(newCity);
});
function cityIp(location) {
var queryURL = "https://ip-geo-location.p.rapidapi.com/ip/check"
$.ajax({
url: queryURL,
method: "GET"
}).then(function (response) {
});
}
});