-
Notifications
You must be signed in to change notification settings - Fork 16
/
script.js
27 lines (26 loc) · 7.92 KB
/
script.js
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
$(document).ready(function() {
$('form').submit(function(e) {
e.preventDefault();
let url = 'https://guarded-bayou-51740.herokuapp.com/predict'
let data = JSON.stringify({
"bill_length_mm": $("#bill_length").val(),
"bill_depth_mm": $("#bill_depth").val()
})
// console.log(data);
$.post(url, data, function(response) {
if (response == "Gentoo"){
$('#penguin-summary').html("<h1>Those parameters best match a Gentoo Penguin</h1><ul class='summary'><li><b>COMMON NAME:</b> Gentoo Penguin</li><li><b>SCIENTIFIC NAME:</b> Pygoscelis papua</li><li><b>TYPE:</b> Birds</li><li><b>DIET:</b> Carnivore</li><li><b>GROUP NAME:</b> Colony</li><li><b>AVERAGE LIFE SPAN IN THE WILD:</b> 15 to 20 years</li><li><b>SIZE:</b> 30 inches</li><li><b>WEIGHT:</b> 12 pounds</li></ul><div class='description'><p>With flamboyant red-orange beaks, white-feather caps, and peach-colored feet, gentoo penguins stand out against their drab, rock-strewn Antarctic habitat.</p><h3>Habitat</h3><p>These charismatic waddlers, who populate the Antarctic Peninsula and numerous islands around the frozen continent, are the penguin world’s third largest members, reaching a height of 30 inches and a weight of 12 pounds.</p><p>Gentoos are partial to ice-free areas, including coastal plains, sheltered valleys, and cliffs. They gather in colonies of breeding pairs that can number from a few dozen to many thousands.</p><h3>Parenting</h3><p>Gentoo parents, which often form long-lasting bonds, are highly nurturing. At breeding time, both parents will work to build a circular nest of stones, grass, moss, and feathers. The mother then deposits two spherical, white eggs, which both parents take turns incubating for more than a month. Hatchlings remain in the nest for up to a month, and the parents alternate foraging and brooding duties.</p><h3>Underwater Adaptations</h3><p>Like all penguins, gentoos are awkward on land. But they’re pure grace underwater. They have streamlined bodies and strong, paddle-shaped flippers that propel them up to 22 miles an hour, faster than any other diving bird.</p><h3>Hunting</h3><p>Adults spend the entire day hunting, usually close to shore, but occasionally ranging as far as 16 miles out. When pursuing prey, which includes fish, squid, and krill, they can remain below for up to seven minutes and dive as deep as 655 feet.</p><h3>Threats to Survival</h3><p>Gentoo penguins are a favored menu item of the leopard seals, sea lions, and orcas that patrol the waters around their colonies. On land, adults have no natural predators other than humans, who harvest them for their oil and skin. Gentoo eggs and chicks, however, are vulnerable to birds of prey, like skuas and caracaras.</p><p>Gentoo numbers are increasing on the Antarctic Peninsula but have plummeted in some of their island enclaves, possibly due to local pollution or disrupted fisheries. They are protected by the Antarctic Treaty of 1959 and received near threatened status on the IUCN Red List in 2007.</p></div>")
}
else if (response == "Adelie"){
$('#penguin-summary').html("<h1>Those parameters best match an Adélie Penguin</h1><ul class='summary'><li><b>COMMON NAME:</b> Adélie Penguin</li><li><b>SCIENTIFIC NAME:</b> Pygoscelis adeliae</li><li><b>TYPE:</b> Birds</li><li><b>DIET:</b> Carnivore</li><li><b>GROUP NAME:</b> Colony</li><li><b>AVERAGE LIFE SPAN IN THE WILD:</b> 11 to 20 years</li><li><b>SIZE:</b> 27.5 inches</li><li><b>WEIGHT:</b> 8.5 to 12 pounds</li></ul><div class='description'><p>Adélie penguins live on the Antarctic continent and on many small, surrounding coastal islands. They spend the winter offshore in the seas surrounding the Antarctic pack ice.</p><h3>Diet</h3><p>Adélies feed on tiny aquatic creatures, such as shrimp-like krill, but also eat fish and squid. They have been known to dive as deep as 575 feet in search of such quarry, though they usually hunt in far shallower waters less than half that depth.</p><p>Like other penguins, Adélies are sleek and efficient swimmers. They may travel 185 miles round-trip to procure a meal.</p><h3>Breeding</h3><p>During the spring breeding season (in October), they take to the rocky Antarctic coastline where they live in large communities called colonies. These groups can include thousands of birds.</p><p>Once on land, Adélies build nests and line them with small stones. Though they move with the famed “penguin waddle” they are capable walkers who can cover long overland distances. In early spring, before the vast sheets of ice break up, they may have to walk 31 miles from their onshore nests to reach open water.</p><p>Male Adélie penguins help their mates rear the young and, without close inspection, the two sexes are nearly indistinguishable. They take turns sitting on a pair of eggs to keep them warm and safe from predators. When food is short, only one of the two chicks may survive. After about three weeks, parents are able to leave the chicks alone, though the offspring gather in groups for safety. Young penguins begin to swim on their own in about nine weeks.</p></div>")
}
else if (response == "Chinstrap"){
$('#penguin-summary').html("<h1>Those parameters best match a Chinstrap Penguin</h1><ul class='summary'><li><b>COMMON NAME:</b> Chinstrap Penguin</li><li><b>SCIENTIFIC NAME:</b> Pygoscelis antarcticus</li><li><b>TYPE:</b> Birds</li><li><b>DIET:</b> Carnivore</li><li><b>GROUP NAME:</b> Colony</li><li><b>SIZE:</b> 28 inches</li><li><b>WEIGHT:</b> 6.6 to 11 pounds</li></ul><div class='description'><p>Instantly recognizable by the black band that gives them their name, chinstrap penguins are the most abundant penguin in the Antarctic, where they gather in massive breeding colonies.</p><p>After spending the winter north of the sea ice, chinstraps return in late October or early November to their nest sites, usually with the same breeding partners. These colonies are on the rocky, ice-free coasts of the South Sandwich Islands, South Shetland Islands, and Antarctic continent.</p><p>The sheer number of birds in the colonies is astounding. The largest colony, on the uninhabited South Sandwich island of Zavodovski, hosts some 1.2 million breeding pairs. Baily Head in the South Shetland Islands is home to more than 100,000 pairs.</p><h3>Breeding and nesting</h3><p>A female chinstrap typically will lay two eggs in a circular nest made from stones. The parents share egg-sitting duties, each spending several days on the nest before a shift change. After about 37 days, the chicks hatch. They spend another few weeks in the nest, then waddle into a crèche, where the fluffy, gray juveniles are cared for communally. At around two months old, they get their adult feathers and are able to head to sea.</p><h3>Threats</h3><p>In the water, where they feed primarily on krill, the penguins’ main predator is the leopard seal. On land, chinstraps face threats from skuas, giant petrels, and other birds that steal the penguins’ eggs and attack chicks, as well as a more unusual threat: volcanic activity. An ill-timed eruption in 2016 on Zavodovski Island covered much of the colony in ash as the birds were undergoing their annual molt. During molt, when they lose their waterproof feathers, they are land-locked and can’t go in the sea until their feathers regrow.</p><p>Chinstrap penguin numbers increased in the mid-20th century, attributed by some to the rebound of krill from centuries of seal and whale hunting. Today, some populations are declining, though not precipitously. Restrictions are in place to keep tourists from approaching breeding birds too closely.</p></div>")
}
else {
$('#penguin-summary').html("<h3>Bill Length inputs must be between 32 and 60 milimeters</h3><br><h3>Bill Depth inputs must be between 13 and 22 milimeters</h3><br>")
}
});
$('#penguin-summary').html("<h3>Bill Length inputs must be between 32 and 60 milimeters</h3><br><h3>Bill Depth inputs must be between 13 and 22 milimeters</h3><br>")
});
}); // end ready