Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / mason / brapiclient / trials.mas
blobff49f67a805d8871361b0050ed5254ca154b738d
1 <%args>
2 </%args>
4 <div id="brapi_home_trial_search_div">
6     <h4>Trial Search</h4>
7     <input name="brapi_home_trials_locationid" id="brapi_home_trials_locationid" class="form-control" type="text" placeholder="LocationDbId e.g. 23" value="23"/>
8     <input name="brapi_home_trials_programid" id="brapi_home_trials_programid" class="form-control" type="text" placeholder="ProgramDbId e.g. 134" value="134"/>
9     <button class="btn btn-primary" name="brapi_home_trial_search_submit" id="brapi_home_trial_search_submit">Get Trials</button>
10     <br/><br/>
11     <div id="brapi_trials_result_div">
12     </div>
14 </div>
16 <script>
18 jQuery(document).ready(function() {
19     jQuery("#brapi_home_trial_search_submit").click(function() {
21         jQuery.ajax( {
22           'url':  jQuery('#brapi_home_url_select').val()+'/brapi/v1/trials?locationDbIds='+jQuery('#brapi_home_trials_locationid').val()+'&programDbIds='+jQuery('#brapi_home_trials_programid').val(),
23           'method': 'GET',
24           'success': function(response) {
25             console.log(response);
26             brapi_create_paginated_table(response.result.data, response.metadata.pagination, 'brapi_trials_result_div',  jQuery('#brapi_home_url_select').val()+'/brapi/v1/trials?locationDbId='+jQuery('#brapi_home_trials_locationid').val()+'&programDbId='+jQuery('#brapi_home_trials_programid').val(), undefined);
28           },
29           error: function(response) {
30             alert('An error occurred');
31           }
32         });
33     });
34 });
36 </script>