This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

rafaelteboekhorst56221
rafaelteboekhorst56221

Hello!
I have a homepage with a searchbar. After I specified my search and click on the search button, I want to be relinked to another page and I want the queried results to be shown there. How can I do this with Ajax?

I have been trying something like this:

This is my search button:

 <button type="submit" class="btn rehomes-search-btn" id="ajaxSearch">Zoeken</button      

my ajax request is done by this:

{{ form_ajax('onFilterHouses', { update: { 'sections/housesForSale': '#partialHouses', 'sections/paginate': '#partialPaginate' } }) }}

here is my jquery:

(function($){

$( "#ajaxSearch" ).click(function() {

  var postthis = $('.ajax-form').request();

  window.location("http://website/vastgoed-aanbod-in-spanje";)

  return postthis;

});

})(jQuery);

Last updated

mjauvin
mjauvin

If you're redirecting to another page, I see no point of using AJAX... just use the new location as the form action parameter and do the search from that page's php code section.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.