diff --git a/searx/templates/__common__/opensearch.xml b/searx/templates/__common__/opensearch.xml
index 27634245..7fdc1f7d 100644
--- a/searx/templates/__common__/opensearch.xml
+++ b/searx/templates/__common__/opensearch.xml
@@ -13,6 +13,6 @@
{% endif %}
{% if autocomplete %}
-
+
{% endif %}
diff --git a/searx/webapp.py b/searx/webapp.py
index 2df96e19..f79525d3 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -790,12 +790,12 @@ def autocompleter():
results.append(raw_text_query.getFullQuery())
# return autocompleter results
- if request.form.get('format') == 'x-suggestions':
- return Response(json.dumps([raw_text_query.query, results]),
+ if request.headers.get('X-Requested-With') == 'XMLHttpRequest':
+ return Response(json.dumps(results),
mimetype='application/json')
- return Response(json.dumps(results),
- mimetype='application/json')
+ return Response(json.dumps([raw_text_query.query, results]),
+ mimetype='application/x-suggestions+json')
@app.route('/preferences', methods=['GET', 'POST'])