Merge pull request #5243 from solgenomics/topic/observations_upload_catch_error
[sgn.git] / mason / brapiclient / observation_levels.mas
blob8bd2fa2730eba5750689f0f9028706a369ba820c
1 <%args>
2 </%args>
4 <h4>Observation Levels</h4>
6 <div id="brapi_obslevel_home_div">
7 <button class="btn btn-primary" id="brapi_home_show_obslevels">Show ObservationLevels</button>
9 </div>
11 <script>
13 jQuery(document).ready(function() {
15 jQuery("#brapi_home_show_obslevels").click(function() {
16     jQuery.ajax( {
17       'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/observationLevels',
18       'method': 'GET',
19       'success': function(response) {
20         console.log(response);
21         var html = '<br/><ul>';
22         for(var i = 0; i < response.result.data.length; i++) {
23             html = html+'<li>'+response.result.data[i]+'</li>';
24         }
25         html = html+'</ul>';
26         jQuery("#brapi_obslevel_home_div").empty().html(html);
27       },
28       error: function(response) {
29         alert('An error occurred');
30       }
31     });
32 });
34 });
36 </script>