This method will provide you with a list of all breeds for a given animal type.
Animal
- a string representing the type of animal we want the breed list of. See the breed.list entry in the official API docs for all available animal types.
Below is a simple form using the method.
function runQuery(){ var selection = $("#mySelector"); var animalType = selection[0].options[selection[0].selectedIndex].value; var baseURL = "https://api.petfinder.com/"; var reqType = "breed.list?"; var params = "animal=" + animalType +"&"; var yourKey = "key=123456789&"; var format = "format=json"; var callback = "&callback=?"; var dataSpot = $("#result"); var fullURL = baseURL+reqType+params+yourKey+format+callback; $(document).ready(function(){ $.ajax({ dataType: "jsonp", url: fullURL, success:(function(data){ var breeds = data.petfinder.breeds.breed; dataSpot.html('<ul id="animalName"><h4>' + animalType + '</h4></ul>'); $.each(breeds, function(value){ var li = $('<li/>') .text(breeds[value].$t) .appendTo($("#animalName")); }); }) }); });
Nothing here yet. Submit request on 'Form' tab.