AJAX-powered Headway search block – 01

While there are plenty of plugins implementing AJAX-powered and live search functions Headway, in its basic version, will offer a search “widget” in the navigation block alone and that, in the context of the single-page site I’m trying to build, really is a limit.
I’ve decided to implement an AJAX-powered search block to complement the AJAX-powered navigation block and, to stick with a measurable progress, jotted down the features of its first iteration:

  • the block will use WordPress default get_searc_form function to produce the markup
  • the block will prevent the click of the Submit button from loading the results page
  • the block will allow a theme developer to set the jQuery selector to display the results in, trying to display them, by default, in the the Content block
  • the block will allow a theme developer to set the jQuery selector to use to filter the search results filtering them, by default, using the Content block content
  • the block will allow the theme developer to activate the live search function and to set its char count threshold (3 by default)
  • the block will allow a theme developer to set JavaScript callback functions to use for transitions, failed loading, key up and submit events

The block will follow along the line drawn with the AJAX-powered navigation block and will hence come with no styling options leaving that and the possibility to set and use JavaScript callback functions to the developer.
Some more options for future iterations might allow for more markup flexibility and the integration with more focused search-related plugins; I code for my own needs and this current iteration will give all the customization I need for the project at hand.

I appreciate your input