diff options
author | John Nduli | 2024-09-11 15:22:16 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-11 16:56:35 +0300 |
commit | 82140bbb3384845ec71ad0f77c7b73c736baf767 (patch) | |
tree | 777ebcfb4e7e8f454e7d6221f35ef9efc79164c6 /gn2/wqflask/templates | |
parent | 61c4b9a2cebe94db400c41c4a7bef4ab7f1b3a40 (diff) | |
download | genenetwork2-82140bbb3384845ec71ad0f77c7b73c736baf767.tar.gz |
feat: async js loading for fahamu results
Diffstat (limited to 'gn2/wqflask/templates')
-rw-r--r-- | gn2/wqflask/templates/gsearch_gene.html | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gn2/wqflask/templates/gsearch_gene.html b/gn2/wqflask/templates/gsearch_gene.html index ecb8de8f..091cc435 100644 --- a/gn2/wqflask/templates/gsearch_gene.html +++ b/gn2/wqflask/templates/gsearch_gene.html @@ -272,8 +272,9 @@ }); </script> + {% if do_ai_search %} <script type='text/javascript'> - function ai_content_div(search_term, search_result) { + function ai_content_div(search_term, search_result, search_uri) { return ` <div class="col-sm-6"> <div class="panel panel-info"> @@ -287,7 +288,7 @@ <div id="ai_results" class="panel-collapse collapse" role="tabpanel" aria-labelledby="ai_heading"> <div class="panel-body"> <p>${ search_result }</p> - <p><a class="btn btn-default" href="${search_term}" role="button">See References</a></p> + <p><a class="btn btn-default" href="${ search_uri }" role="button">See References</a></p> </div> </div> </div> @@ -296,9 +297,19 @@ } $(document).ready( function () { - let ai_div = ai_content_div("this is a test", "test contains some text"); - $("#ai_result").append(ai_div); + $.ajax({url: "gnqna", + contentType: "application/json", + data: { + query: "{{ terms }}", + type: "xapian", + }, + success: function(result) { + let ai_div = ai_content_div(result.search_term, result.search_result, result.search_url) + $("#ai_result").append(ai_div); + } + }) }) </script> + {% endif %} {% endblock %} |