Created
May 25, 2017 07:09
-
-
Save bhavjot/faf1c126d7e9e96a06e7d6b29812cccc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
function resultCb(res){ | |
console.log(res); | |
res.sort(function(a, b){ | |
if(a < b) return -1; | |
if(a > b) return 1; | |
return 0; | |
}); | |
$.each(res,function(title){ | |
$(".news-body").append("<div>" + title+"</div"); | |
}); | |
} | |
$(".button").click(function(){ | |
var input = $(".secret").val(); | |
var res=[]; | |
$.getJSON("key.json", function(keyjson) { | |
for(input in keyjson ) | |
{ | |
$.getJSON("secret_json/"+input+".json", function(json) { | |
res.push(json["news_title"]); | |
if(res.length === 75) resultCb(res); | |
}); | |
} | |
}); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment