aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2016-06-15 06:09:04 +0000
committerPjotr Prins2016-06-15 06:09:04 +0000
commit635aa00393b7d97a38a94a2bd74a6b29b4d5fb24 (patch)
treebb0dd496b45fe66321873bd7f7d3a5edd3ef0451
parentc1ff3255b45a7ae361679a97a9760a61d79b8daf (diff)
downloadgenenetwork2-635aa00393b7d97a38a94a2bd74a6b29b4d5fb24.tar.gz
Menu: refactoring code, handling error
-rw-r--r--wqflask/wqflask/static/new/javascript/dataset_select_menu.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
index f62abbf3..02451925 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
+++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js
@@ -10,27 +10,23 @@ $(function() {
dataType: 'json',
success: process_json
});
- $.getJSON("http://localhost:8880/int/menu/main",
+ $.getJSON("http://localhost:8880/int/menu/main.json",
function(data) {
gndata = data;
console.log("***** GOT DATA from GN_SERVER ****");
console.log(gndata);
- var species = gndata.species.map(function(item) {
- // console.log(item)
- menu = [item[1],item[2]]
- // console.log(menu)
- return menu;
- });
- console.log(species);
- redo_dropdown($('#species'), species);
- populate_group();
- });
+ populate_species();
+ }).error(function() {
+ console.log("ERROR: GN_SERVER not responding");
+ alert("ERROR: GN_SERVER internal REST API is not responding");
+ });
populate_species = function() {
- // var species_list;
- // species_list = this.jdata.species;
- // redo_dropdown($('#species'), species_list);
- return populate_group();
+ var species = gndata.species.map(function(item) {
+ return item.slice(1,3);
+ });
+ redo_dropdown($('#species'), species);
+ return populate_group();
};
window.populate_species = populate_species;
populate_group = function() {