-
Notifications
You must be signed in to change notification settings - Fork 1
/
donors-choose.js
16 lines (14 loc) · 1010 Bytes
/
donors-choose.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$(document).ready(function() {
var zip = $("#hZip").val();
$.getJSON('http://api.donorschoose.org/common/json_feed.html?zipcode=' + zip + '&APIKey=DONORSCHOOSE&callback=?', function(data) {
var output = "";
output += '<h3>Donate To Area Schools</h3>';
output += '<strong>' + data["proposals"][0]["title"] + '</strong>';
output += '<img src="' + data["proposals"][0]["imageURL"] + '" alt="' + data["proposals"][0]["title"] + '"/><br /><br />';
output += '<p>' + data["proposals"][0]["fulfillmentTrailer"] + ' <a href="" target="_blank">Read More...</a></p>';
output += '<p><strong>Needs $' + data["proposals"][0]["costToComplete"] + ' to complete</strong><br />';
output += '<small>' + data["proposals"][0]["percentFunded"] + '% of the way there</small></p>';
output += '<p><a href="'+ data["proposals"][0]["fundURL"] +'" class="btn btn-primary"><i class="icon-shopping-cart icon-white"></i> Fund Project</a></p>';
$("#donors-choose-widget").html(output);
});
});