Merge pull request #4327 from solgenomics/topic/reduce_pheno_dl_query_length
[sgn.git] / mason / brapiclient / traits.mas
blob5198e9350189604285dd5e4678cbb7da0d8ea9d6
1 <%args>
2 </%args>
4 <div id="brapi_home_traits_div">
6     <h4>Traits</h4>
7     <button class="btn btn-primary" name="brapi_home_traits_submit" id="brapi_home_traits_submit">Get Traits</button>
8     <br/><br/>
9     <div id="brapi_traits_data_result_div">
10     </div>
12 </div>
14 <script>
16 jQuery(document).ready(function() {
17     jQuery("#brapi_home_traits_submit").click(function() {
18         jQuery.ajax( {
19           'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/traits',
20           'method': 'GET',
21           'beforeSend': function() {
22             jQuery('#working_modal').modal('show');
23           },
24           'success': function(response) {
25             jQuery('#working_modal').modal('hide');
26             console.log(response);
27             brapi_create_paginated_table(response.result.data, response.metadata.pagination, 'brapi_traits_data_result_div', jQuery('#brapi_home_url_select').val()+'/brapi/v1/traits', undefined);
29           },
30           error: function(response) {
31             jQuery('#working_modal').modal('hide');
32             alert('An error occurred');
33           }
34         });
35     });
36 });
38 </script>