Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

Consider HTTP request when running search categories on select is enabled

Noémi Ványi4ec2fab583d5
diff --git a/searx/static/plugins/js/search_on_category_select.js b/searx/static/plugins/js/search_on_category_select.js
index 1c42d9e9e..d590ed127 100644
--- a/searx/static/plugins/js/search_on_category_select.js
+++ b/searx/static/plugins/js/search_on_category_select.js
@@ -6,19 +6,37 @@ $(document).ready(function() {
});
$(document.getElementById($(this).attr("for"))).prop('checked', true);
if($('#q').val()) {
+ if (getHttpRequest() == "GET") {
+ $('#search_form').attr('action', $('#search_form').serialize());
+ }
$('#search_form').submit();
}
return false;
});
$('#time-range').change(function(e) {
if($('#q').val()) {
+ if (getHttpRequest() == "GET") {
+ $('#search_form').attr('action', $('#search_form').serialize());
+ }
$('#search_form').submit();
}
});
$('#language').change(function(e) {
if($('#q').val()) {
+ if (getHttpRequest() == "GET") {
+ $('#search_form').attr('action', $('#search_form').serialize());
+ }
$('#search_form').submit();
}
});
}
});
+
+function getHttpRequest() {
+ httpRequest = "POST";
+ urlParams = new URLSearchParams(window.location.search);
+ if (urlParams.has('method')) {
+ httpRequest = urlParams.get('method');
+ }
+ return httpRequest;
+}