Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function makeStatusIndicator(loan_id){
// this function executes the Kiva API query for a particular loan id, feeds the result through
// the actionable model, and returns a green light or red light icon depending on the result.
// create DOM object for icon
var img = $('<img class="indicator">') ;
// Kiva API call
var url = "" + loan_id + ".json" ;
// pass response to actionable model
var data =[0] ;
var status = predictStatus(data.funded_amount,,data.loan_amount,data.sector) ;
// create the indicator. use chrome.extension.getURL to resolve path to image resource
if (status == "paid"){
img.attr("src",chrome.extension.getURL("images/green_light.png")) ;
img.attr("src",chrome.extension.getURL("images/red_light.png")) ;
img.attr("title","The predicted status for this loan is: " + status.toUpperCase()) ;
return img ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment