E
E
Eugene2015-10-22 17:33:07
JavaScript
Eugene, 2015-10-22 17:33:07

Why is the live ajax search plugin not working?

Good afternoon! I'm trying to make a simple live search for a WP theme using this jquery plugin andreaslagerkvist.com/projects/live-ajax-search
here is the functions.php code

<?php

//enqueue js and css files
add_action( 'wp_enqueue_scripts', 's_print_script' );
function s_print_script() {
  wp_enqueue_script( 'jquery' );
  wp_enqueue_script( 'foot2livesearch', get_stylesheet_directory_uri().'/js/foot-2-live-search.js', '');
  wp_enqueue_style( 'livesearchcss', get_stylesheet_directory_uri().'/css/live-search.scss');
}


add_shortcode('s_search_form_shortcode', 's_search_form_shortcode');
function s_search_form_shortcode(){
?>
<form method="get" action="/" id="live-search-example">
    <div><input type="text" name="s" placeholder="Search"></div>
</form>

<script type="text/javascript">
  LiveSearch.init(document.getElementById('live-search-example').querySelector('input[name=s]'), {url: '/?s='});
</script>
<?php
}
?>


in chrome console error
Uncaught ReferenceError: SimpleAjax is not defined(anonymous function) @ foot-2-live-search.js?ver=4.3.1:63 what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-10-22
@dimonchik2013

stackoverflow.com/questions/18963022/jquery-ajax-r...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question