Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Behaviour not to be redirected when searching
This topic contains 3 replies, has 2 voices, and was last updated by Bastien 8 years, 10 months ago.
- AuthorPosts
- January 11, 2015 at 8:26 pm #3429
Hi,
I am very impressed by Ajax Search Pro. Admin panel is impressive.
I wanted to have the behaviour as in the demo on the page http://wp-dreams.com/demo/wp-ajax-search-pro3/woocommerce-example/.
When I click the search icon or the return key, there is no redirection to the search page. I tried to do it by putting off the two parameters I found in the admin section in “General Options” > “Behaviour”. I join a screenshot.
But even with the set up, when hitting the return key or the search icon, I am redirecting to the search page.
I want the behaviour to force the user to select one the results.
Thanks a lot for your help.
Have a nice day,Bastien
-
This topic was modified 8 years, 10 months ago by
Bastien.
Attachments:
You must be logged in to view attached files.January 12, 2015 at 3:37 pm #3433Hi!
I’m suspecting a 3rd party javascript (probably from another plugin or theme) which automatically submits the form when pressing the enter key. The search tries to automatically prevent this behaviour, but depending on the method it might fail.
The best you can try is the following javascript code:
jQuery(document).ready(function($){ var scope = $; if (typeof aspjQuery != "undefined") scope = aspjQuery; scope(".proinput input.orig").keydown( function(e) { if (e.which === 13) { e.preventDefault(); e.stopPropagation(); if (typeof(e.stopImmediatePropagation) != "undefined") e.stopImmediatePropagation(); } }); scope("input.orig").parent().submit( function(e) { if (e.which === 13) { e.preventDefault(); e.stopPropagation(); if (typeof(e.stopImmediatePropagation) != "undefined") e.stopImmediatePropagation(); } }); });
Try to add it to the page footer or header. It might work, but if another javascript file is interfeering with the event listeners this might not work.
Also, try to clear your page as well. If you are using any kind of CDN, then their cache as well. The cache can prevent such settings from application.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 12, 2015 at 4:17 pm #3435Hi Ernest,
I think you are right as there is a plugin or the theme which is interfering with this event.
Your snippet works perfectly. Thanks for it and for the awesome support.
Best,
BastienJanuary 12, 2015 at 6:39 pm #3436 -
This topic was modified 8 years, 10 months ago by
- AuthorPosts
You must be logged in to reply to this topic.