From 9dd738ed57a67f9fdf63d005738b53883e33eab7 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Tue, 5 Apr 2022 15:09:14 +0100 Subject: [PATCH] Replaced getJSON with an Ajax request. --- resources/js/cafevariome/query_builder.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/resources/js/cafevariome/query_builder.js b/resources/js/cafevariome/query_builder.js index bbf111f3..32418a25 100644 --- a/resources/js/cafevariome/query_builder.js +++ b/resources/js/cafevariome/query_builder.js @@ -186,13 +186,22 @@ $(function() { $('select#values_phen_left').empty() var arrayToReduce = $(this).val().trim().split(' ').filter((term) => term.length != 1); str = (arrayToReduce.length > 0) ? arrayToReduce.reduce((v1, v2) => v1 + " " + v2) : ''; - $.getJSON(hpo_autocomplete_url + (str) , (data) => { - $('select#values_phen_left').empty() - data.forEach((term) => { - $('select#values_phen_left').append($('').attr('value', term).text(term)) - }) - }) - .fail(function() { }); + + $.ajax({ + url: hpo_autocomplete_url + str, + type: 'GET', + dataType:'json', + crossDomain: true, + success: function (data, textStatus, jqXHR) { + $('select#values_phen_left').empty() + data.forEach((term) => { + $('select#values_phen_left').append($('').attr('value', term).text(term)) + }) + } + }).done(function() { + + }); + $search_str = $(this).val() })