Autocomplete throws all results on the screen after submit from form.

Autocomplete throws all results on the screen after submit from form.

Hi, I'm trying send from a div towards iframe, a form's value and when iframe shows up, it take every value from autocomplete. I know where come from the problem, but I can't make it work in other way.

This is the code where form is, very simple:

  1. <script type="text/javascript">
    $().ready(function() {
    $('#searchFor').autocomplete({source:'functions/printNameServers.php', minLength:2});
    });
    </script>
    ...
    ...
       <form id="formSearchFor" target="mainIframe" action="mod/showServer.php" method="get">
         <input name="searchFor" id="searchFor" size="25" style="font-size:9px;" type="text"/>         
        </form>

and here is where automplete get back the info required:


  1. $query = "SELECT server_Name FROM servers WHERE server_description LIKE ".$dato_final;
    $mk = mysql_query($query);
    while ($a=mysql_fetch_array($mk)) { $data[] = array( 'value' => $a['server_Name']); }
    echo json_encode($data);
    flush();

I can figure out, echo command, is responsable, but, I don“t know make work autocomplete without it.

Just when return is pressed in the form, the target looks like this:




In the target there's no code but background image.

Thank you for support.