I have seen this question about using Low Search with Ajax but I still don't see how to integrate them.
Given this form
{exp:low_search:form collection="foo" search_mode="any" result_page="foo/search" form_id="search_form"}
<fieldset>
<label for="keywords">Keywords</label>
<input type="search" name="keywords" id="keywords" />
<button type="submit" id="search">Search</button>
</fieldset>
{/exp:low_search:form}
and this Javascript code
$(document).ready(function(){
$("#search_form").on("submit", function(event){
event.preventDefault();
// HOW DO I GET THE ENCODED STRING HERE?
var aData = [],
sSource = $(this).attr("action");
$.ajax(
{
'dataType': 'json',
'type': 'POST',
'url': sSource,
'data': aData,
'success': function (oAjaxData, sTextStatus)
{
},
'error': function (jqXHR, sTextStatus, errorThrown)
{
console.log(sTextStatus);
},
'complete': function (jqXHR, sTextStatus)
{}
});
});
});
How do I get the encoded query string in the Javascript code?