Jump to content
Sign in to follow this  

jQuery auto complete producing results bug

Recommended Posts

I'm struggling to produce results to the screen from the following code:



<script src="http://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

<script src="../scripts/autocomplete.js"></script>

    <input type='text' class='search_input' name='search' id='search' placeholder='search' autofocus onkeypress='search_func("http://webfarm.io/subs/homefront/list_articles.php" , "search_output")'>

    <div id='search_output' class='search_output'></div>


function search_func( href , target){
        var search = $("#search").val();
        search = $.trim(search);

                method: "POST",
                url: href ,
                data: { search: search }
                .done(function( msg ) {
                    target.innerHTML = msg; // as above, data holds the result of the request, so all the data returned from your results.php file are in this param but please see below;
        } else {
            target.innerHTML = '';

What am I doing wrong?

Why won't it produce the desired results?

Sorry if I'm looking like a help vamp, but I'm not trying to be.

Share this post

Link to post
Share on other sites
target is merely the string "search_output". Not the element.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.