Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  <meta charset="utf-8">
  <title>AJAX + fx</title>
</head>
<body>
</body>
</html>
 
var r;
function fetchPersonnes() {
    // Fetch
    $.ajax({type: "GET",
      url: "http://output.jsbin.com/fokuyi/1.js",
      dataType: "json",
      success: handleData                    
    });  
}
function handleData (personnes) { 
    personnes.sort(sortByBorn);
    pTab = filter(personnes, function(person) {
        return person.born > 1500 && person.born < 1800;
    });
    
    pTab.forEach(function(p){
        console.log(p.name, p.born);
    });
}
function sortByBorn(A, B){
    return (A.born - B.born);
}
function filter(array, test) {
  var passed = [];
  for (var i = 0; i < array.length; i++) {
    if (test(array[i]))
      passed.push(array[i]);
  }
  return passed;
}
$(document).ready(function() {
    fetchPersonnes();
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
dupontpro
0viewers